Fix several issues with bootprompt

This commit is contained in:
Alexandre Aubin 2019-01-07 18:26:38 +01:00
parent 6a7990d7fb
commit bbfa9fc124

View file

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
# Fetch ips
ip=$(hostname --all-ip-address)
# Fetch SSH fingerprints # Fetch SSH fingerprints
i=0 i=0
for key in $(ls /etc/ssh/ssh_host_{ed25519,rsa,ecdsa}_key.pub 2> /dev/null) ; do for key in $(ls /etc/ssh/ssh_host_{ed25519,rsa,ecdsa}_key.pub 2> /dev/null) ; do
@ -32,11 +29,17 @@ EOF
# Build the actual message # Build the actual message
# #
sleep 5
# Get local IP
# (we do this after the sleep 5 to have
# better chances that the network is up)
local_ip=$(hostname --all-ip-address | awk '{print $1}')
LOGO_AND_FINGERPRINTS=$(cat << EOF LOGO_AND_FINGERPRINTS=$(cat << EOF
$LOGO $LOGO
IP: ${ip} IP: ${local_ip}
SSH fingerprints: SSH fingerprints:
${fingerprint[0]} ${fingerprint[0]}
${fingerprint[1]} ${fingerprint[1]}
@ -51,17 +54,35 @@ if [[ -f /etc/yunohost/installed ]]
then then
echo "$LOGO_AND_FINGERPRINTS" > /etc/issue echo "$LOGO_AND_FINGERPRINTS" > /etc/issue
else else
sleep 5
chvt 2 chvt 2
# Formatting
[[ -n "$local_ip" ]] && local_ip=$(echo -e "https://$local_ip/") || local_ip="(no ip detected?)"
echo "$LOGO_AND_FINGERPRINTS" echo "$LOGO_AND_FINGERPRINTS"
echo -e "\e[m Post-installation \e[0m" cat << EOF
echo "Congratulations! YunoHost has been successfully installed.\nTwo more steps are required to activate the services of your server." ===============================================================================
read -p "Proceed to post-installation? (y/n)\nAlternatively, you can proceed the post-installation on https://${ip}" -n 1 You should now proceed with Yunohost post-installation. This is where you will
be asked for :
- the main domain of your server ;
- the administration password.
You can perform this step :
- from your web browser, by accessing : ${local_ip}
- or in this terminal by answering 'yes' to the following question
If this is your first time with YunoHost, it is strongly recommended to take
time to read the administator documentation and in particular the sections
'Finalizing your setup' and 'Getting to know YunoHost'. It is available at
the following URL : https://yunohost.org/admindoc
===============================================================================
EOF
read -p "Proceed with post-installation? (y/n) "
RESULT=1 RESULT=1
while [ $RESULT -gt 0 ]; do while [ $RESULT -gt 0 ]; do
if [[ $REPLY =~ ^[Nn]$ ]]; then if [[ $REPLY =~ ^[Nn]$ ]]; then
chvt 1 break
exit 0
fi fi
echo -e "\n" echo -e "\n"
/usr/bin/yunohost tools postinstall /usr/bin/yunohost tools postinstall
@ -71,4 +92,6 @@ else
read -p "Retry? (y/n) " -n 1 read -p "Retry? (y/n) " -n 1
fi fi
done done
chvt 1
exit 0
fi fi