From 5ddbc1692c385011709485c76b00463875742fc9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 9 May 2018 02:34:02 +0200 Subject: [PATCH] Add first time script that force resize2fs + message about running the postinstall --- stage3/00-install-yunohost/00-run.sh | 2 ++ .../files/check_yunohost_is_installed.sh | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 stage3/00-install-yunohost/files/check_yunohost_is_installed.sh diff --git a/stage3/00-install-yunohost/00-run.sh b/stage3/00-install-yunohost/00-run.sh index 7a7c146..0daadc5 100755 --- a/stage3/00-install-yunohost/00-run.sh +++ b/stage3/00-install-yunohost/00-run.sh @@ -28,6 +28,8 @@ sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config echo "root:yunohost" | chpasswd EOF +install -m 755 files/check_yunohost_is_installed.sh "${ROOTFS_DIR}/etc/profile.d/" + echo "Cleaning ..." on_chroot << EOF apt-get clean diff --git a/stage3/00-install-yunohost/files/check_yunohost_is_installed.sh b/stage3/00-install-yunohost/files/check_yunohost_is_installed.sh new file mode 100644 index 0000000..5d0e8f9 --- /dev/null +++ b/stage3/00-install-yunohost/files/check_yunohost_is_installed.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ -n "$BASH_VERSION" ] && [ "$-" != "${-#*i}" ]; then + + # Trigger resize2fs_once in case it wasnt triggered so far ... + if [ -f "/etc/init.d/resize2fs_once" ]; + then + echo "Resizing root partition ... (this may take up to a few minutes)" + systemctl restart resize2fs_once + fi + + if [ ! -f "/etc/yunohost/installed" ]; + then + normal=$(printf '\033[0m') + bold=$(printf '\033[1m') + blue=$(printf '\033[34m') + + IPS=$(hostname --all-ip-address | sed 's/ /\n /g') + cat << EOF +====================================================================== +${bold}${blue} + Congratulations on setting up your YunoHost server ! +${normal}${bold} + To finish the installation, you should run the postinstallation. + You can find documentation about it on :${normal} + https://yunohost.org/postinstall +${normal}${bold} + You can run it from the command line interface with :${normal} + $ yunohost tools postinstall +${normal}${bold} + Or from a browser by accessing one of your local IP :${normal} + $IPS${normal} +====================================================================== +EOF + fi +fi