mirror of
https://github.com/YunoHost/install_script.git
synced 2024-09-03 20:06:25 +02:00
Upgrade system before starting install
This commit is contained in:
parent
459dc9cbab
commit
bc19749f01
1 changed files with 32 additions and 26 deletions
|
@ -15,7 +15,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
YUNOHOST_LOG="/var/log/yunohost.log"
|
YUNOHOST_LOG="/var/log/yunohost-installation.log"
|
||||||
|
|
||||||
print() {
|
print() {
|
||||||
printf "%s\n" "$*";
|
printf "%s\n" "$*";
|
||||||
|
@ -30,9 +30,7 @@ Installation logs are located in $YUNOHOST_LOG
|
||||||
|
|
||||||
success() {
|
success() {
|
||||||
tput setf 2
|
tput setf 2
|
||||||
print "
|
print "Success !"
|
||||||
Success !
|
|
||||||
"
|
|
||||||
tput sgr 0
|
tput sgr 0
|
||||||
notify_about_install_logs
|
notify_about_install_logs
|
||||||
}
|
}
|
||||||
|
@ -47,17 +45,16 @@ $1
|
||||||
" >> $YUNOHOST_LOG
|
" >> $YUNOHOST_LOG
|
||||||
|
|
||||||
# Print to terminal
|
# Print to terminal
|
||||||
print "\
|
|
||||||
=================================================="
|
|
||||||
|
|
||||||
tput setf 4
|
tput setf 4
|
||||||
print "
|
print "Failure !"
|
||||||
Failure !
|
tput sgr 0
|
||||||
The following error was caught during Yunohost installation :
|
|
||||||
|
print "\
|
||||||
|
The following error was caught during YunoHost installation :
|
||||||
|
|
||||||
$1
|
$1
|
||||||
" 1>&2
|
" 1>&2
|
||||||
tput sgr 0
|
|
||||||
notify_about_install_logs
|
notify_about_install_logs
|
||||||
exit "${2:-1}"
|
exit "${2:-1}"
|
||||||
}
|
}
|
||||||
|
@ -89,15 +86,20 @@ apt_get_wrapper() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upgrade_system() {
|
||||||
|
apt_get_wrapper update \
|
||||||
|
|| return 1
|
||||||
|
|
||||||
|
apt_get_wrapper -y dist-upgrade \
|
||||||
|
|| return 2
|
||||||
|
}
|
||||||
|
|
||||||
installscript_dependencies() {
|
installscript_dependencies() {
|
||||||
# install dependencies of the install script itself
|
# install dependencies of the install script itself
|
||||||
apt_get_wrapper update \
|
|
||||||
|| return 1
|
|
||||||
|
|
||||||
apt_get_wrapper -o Dpkg::Options::="--force-confold" \
|
apt_get_wrapper -o Dpkg::Options::="--force-confold" \
|
||||||
-y install \
|
-y install \
|
||||||
lsb-release wget whiptail \
|
lsb-release wget whiptail \
|
||||||
|| return 2
|
|| return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
create_custom_config() {
|
create_custom_config() {
|
||||||
|
@ -375,48 +377,52 @@ if ! step ensure_root ; then
|
||||||
die "This script must be run as root" 1
|
die "This script must be run as root" 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! step upgrade_system ; then
|
||||||
|
die "Unable to update the system" 2
|
||||||
|
fi
|
||||||
|
|
||||||
if ! step installscript_dependencies ; then
|
if ! step installscript_dependencies ; then
|
||||||
die "Unable to install dependencies to install script" 2
|
die "Unable to install dependencies to install script" 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step create_custom_config ; then
|
if ! step create_custom_config ; then
|
||||||
die "Creating custom configuration file /etc/yunohost/yunohost.conf failed" 3
|
die "Creating custom configuration file /etc/yunohost/yunohost.conf failed" 4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step set_domain ; then
|
if ! step set_domain ; then
|
||||||
die "Setting hostname failed" 4
|
die "Setting hostname failed" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step confirm_installation ; then
|
if ! step confirm_installation ; then
|
||||||
die "Installation cancelled at your request" 5
|
die "Installation cancelled at your request" 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step setup_package_source ; then
|
if ! step setup_package_source ; then
|
||||||
die "Setting up deb package sources failed" 6
|
die "Setting up deb package sources failed" 7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step apt_update ; then
|
if ! step apt_update ; then
|
||||||
die "Error caught during 'apt-get update'" 7
|
die "Error caught during 'apt-get update'" 8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step register_debconf ; then
|
if ! step register_debconf ; then
|
||||||
die "Unable to insert new values into debconf database" 8
|
die "Unable to insert new values into debconf database" 9
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step workaround_avahi_installation ; then
|
if ! step workaround_avahi_installation ; then
|
||||||
die "Unable to install workaround for avahi installation" 9
|
die "Unable to install workaround for avahi installation" 10
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step install_yunohost_packages ; then
|
if ! step install_yunohost_packages ; then
|
||||||
die "Installation of Yunohost packages failed" 10
|
die "Installation of Yunohost packages failed" 11
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step restart_services ; then
|
if ! step restart_services ; then
|
||||||
die "Error caught during services restart" 11
|
die "Error caught during services restart" 12
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! step post_install ; then
|
if ! step post_install ; then
|
||||||
die "Post-installation failed" 12
|
die "Post-installation failed" 13
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Success !
|
# Success !
|
||||||
|
|
Loading…
Add table
Reference in a new issue