Install bootstrap instead of saving in /tmp/.42
This commit is contained in:
35
bootstrap.sh
35
bootstrap.sh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user