mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Factorize the building of the logo at the top of the script
This commit is contained in:
parent
f25ef833e9
commit
75fc1c03c5
1 changed files with 34 additions and 54 deletions
86
bin/yunoprompt
Normal file → Executable file
86
bin/yunoprompt
Normal file → Executable file
|
@ -1,7 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Fetch ips
|
||||||
ip=$(hostname --all-ip-address)
|
ip=$(hostname --all-ip-address)
|
||||||
|
|
||||||
|
# Fetch SSH fingerprints
|
||||||
i=0
|
i=0
|
||||||
for key in /etc/ssh/ssh_host_*_key.pub ; do
|
for key in /etc/ssh/ssh_host_*_key.pub ; do
|
||||||
output=$(ssh-keygen -l -f $key)
|
output=$(ssh-keygen -l -f $key)
|
||||||
|
@ -9,7 +11,11 @@ for key in /etc/ssh/ssh_host_*_key.pub ; do
|
||||||
i=$(($i + 1))
|
i=$(($i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
cat > /etc/issue.net << EOF
|
#
|
||||||
|
# Build the logo
|
||||||
|
#
|
||||||
|
|
||||||
|
LOGO=$(cat << 'EOF'
|
||||||
'. ' '' -d.
|
'. ' '' -d.
|
||||||
/M+ h- .shh/ // /NMy- hMdosso
|
/M+ h- .shh/ // /NMy- hMdosso
|
||||||
'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+
|
'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+
|
||||||
|
@ -19,6 +25,17 @@ cat > /etc/issue.net << EOF
|
||||||
'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. -
|
'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. -
|
||||||
hy /yy: :- -. -Nh '
|
hy /yy: :- -. -Nh '
|
||||||
.
|
.
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# ' Put a quote in comment to make vim happy about syntax highlighting :s
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build the actual message
|
||||||
|
#
|
||||||
|
|
||||||
|
LOGO_AND_FINGERPRINTS=$(cat << EOF
|
||||||
|
"$LOGO"
|
||||||
|
|
||||||
IP: ${ip}
|
IP: ${ip}
|
||||||
SSH fingerprints:
|
SSH fingerprints:
|
||||||
|
@ -28,38 +45,22 @@ ${fingerprint[2]}
|
||||||
${fingerprint[3]}
|
${fingerprint[3]}
|
||||||
${fingerprint[4]}
|
${fingerprint[4]}
|
||||||
EOF
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
echo "$LOGO_AND_FINGERPRINTS" > /etc/issue.net
|
||||||
|
|
||||||
if [[ ! -f /etc/yunohost/installed ]]
|
if [[ ! -f /etc/yunohost/installed ]]
|
||||||
then
|
then
|
||||||
if [[ ! -f /etc/yunohost/from_script ]]
|
if [[ ! -f /etc/yunohost/from_script ]]
|
||||||
then
|
then
|
||||||
sleep 5
|
sleep 5
|
||||||
chvt 2
|
chvt 2
|
||||||
cat << EOF
|
echo "$LOGO_AND_FINGERPRINTS"
|
||||||
'. ' '' -d.
|
echo -e "\e[m Post-installation \e[0m"
|
||||||
/M+ h- .shh/ // /NMy- hMdosso
|
echo "Congratulations! YunoHost has been successfully installed.
|
||||||
'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+
|
Two more steps are required to activate the services of your server."
|
||||||
sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM'
|
read -p "Proceed to post-installation? (y/n) " -n 1
|
||||||
.sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM.
|
|
||||||
mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M:
|
|
||||||
'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. -
|
|
||||||
hy /yy: :- -. -Nh '
|
|
||||||
.
|
|
||||||
|
|
||||||
IP: ${ip}
|
|
||||||
SSH fingerprints*:
|
|
||||||
${fingerprint[0]}
|
|
||||||
${fingerprint[1]}
|
|
||||||
${fingerprint[2]}
|
|
||||||
${fingerprint[3]}
|
|
||||||
${fingerprint[4]}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo -e "\e[m Post-installation \e[0m"
|
|
||||||
cat << EOF
|
|
||||||
Congratulations! YunoHost has been successfully installed.
|
|
||||||
Two more steps are required to activate the services of your server.
|
|
||||||
EOF
|
|
||||||
read -p "Proceed to post-installation? (y/n) " -n 1
|
|
||||||
RESULT=1
|
RESULT=1
|
||||||
while [ $RESULT -gt 0 ]; do
|
while [ $RESULT -gt 0 ]; do
|
||||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
@ -76,27 +77,6 @@ read -p "Proceed to post-installation? (y/n) " -n 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else # YunoHost is already post-installed
|
else # YunoHost is already post-installed
|
||||||
|
echo "$LOGO_AND_FINGERPRINTS" > /etc/issue
|
||||||
cat > /etc/issue << EOF
|
|
||||||
'. ' '' -d.
|
|
||||||
/M+ h- .shh/ // /NMy- hMdosso
|
|
||||||
'MN' /' '. -' :+ N: .Nmyym yo .MN' omNds: :mN' .sydMMMNds+
|
|
||||||
sMh:/dN: :M' m: oMh' .M: dy h' MM: 'Mo oMh:-sMh /ddNdyyNM'
|
|
||||||
.sMMy' /M' /M- sMMd/sM- -Ms +M+ MM: +M/ mM' -Md 'NM. hM.
|
|
||||||
mM .M- :NN yMMMMMM: .dMNNMd' -/oMMmhmMMh /msosNM/ ::oMM. +M:
|
|
||||||
'MN sMNMM+ mN:.+mM+ -+o/ :hMMm+- 'oN- :oyo- 'yho. -
|
|
||||||
hy /yy: :- -. -Nh '
|
|
||||||
.
|
|
||||||
|
|
||||||
IP: ${ip}
|
|
||||||
SSH fingerprints:
|
|
||||||
${fingerprint[0]}
|
|
||||||
${fingerprint[1]}
|
|
||||||
${fingerprint[2]}
|
|
||||||
${fingerprint[3]}
|
|
||||||
${fingerprint[4]}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue