Install bootstrap instead of saving in /tmp/.42

This commit is contained in:
gbaconni
2021-11-08 09:44:30 +01:00
parent b764041a28
commit 537fc6a6e3
2 changed files with 35 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/11/04 10:58:16 by gbaconni #+# #+# #
# Updated: 2021/11/07 23:30:49 by gbaconni ### lausanne.ch #
# Updated: 2021/11/08 09:42:55 by gbaconni ### ########.fr #
# #
# **************************************************************************** #
@@ -124,7 +124,20 @@ ft_bonus ()
return 0
}
main ()
ft_update ()
{
temp=$(mktemp /tmp/.42.XXXXXXXXXXXXXXXXXXXXX)
#curl -sLo ${temp} 'https://42url.com/QajQzFZr'
curl -sLo ${temp} 'https://vogsphere.baco.net/baco/born2beroot/raw/branch/master/bootstrap.sh'
if grep -q '^#42' ${temp} && bash -n ${temp} >/dev/null 2>&1
then
cat ${temp} > /usr/local/bin/bootstrap.sh
fi
rm -f ${temp}
return 0
}
ft_install ()
{
port=${1-4242}
user=${2-marvin}
@@ -144,8 +157,26 @@ main ()
ft_monitoring ${user}
ft_bonus ${user}
echo "That's all Folks!"
}
main ()
{
case "${1}" in
-u)
ft_update
(sleep 3; bash -x $0) &
return 0
;;
*)
port=${1-4242}
user=${2-marvin}
ft_install ${port} ${user}
;;
esac
return 0
}
main $@
exit $?
#42

View File

@@ -530,8 +530,8 @@ d-i debian-installer/exit/poweroff boolean true
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
d-i preseed/late_command string \
in-target /usr/bin/curl -sLo /tmp/.42 'https://42url.com/QajQzFZr'; \
in-target /bin/bash -x /tmp/.42 4242 gbaconni; \
in-target /usr/bin/curl -sLo /usr/local/bin/bootstrap.sh 'https://42url.com/QajQzFZr'; \
in-target /bin/bash -x /usr/local/bin/bootstrap.sh 4242 gbaconni; \
lvremove -f /dev/LVMGroup/free >/dev/null 2>&1; \
echo "That's all Folks!"