Add noask argument to install playsms

This commit is contained in:
poka 2019-12-11 14:28:29 +00:00
parent 3254d4b24f
commit e42796aa8d
2 changed files with 9 additions and 9 deletions

View File

@ -7,9 +7,13 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
unset err
pwdDB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 42 | head -n 1)
args=$@
[[ $args =~ noask ]] && noask=o
[[ ! $PSMS_DOMAIN ]] && echo -e "${c_yellow}Choisissez un nom de domain pour playsms: $c_" && read PSMS_DOMAIN
sudo apt -y update
sudo apt -y install unzip zip
if [[ $(grep buster /etc/os-release) ]]; then
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.liquidtelecom.com/repo/10.4/debian buster main'
@ -46,8 +50,10 @@ git clone https://github.com/antonraharja/playSMS.git $MY_PATH/playsms
cp $MY_PATH/templates/install-playsms.conf $MY_PATH/playsms/install.conf
sed -i "s/_pwdDB/$pwdDB/g" $MY_PATH/playsms/install.conf
[[ -d /var/www/playsms ]] && sudo rm -rf /var/www/playsms
sudo chmod u+x $MY_PATH/playsms/install-playsms.sh
cd $MY_PATH/playsms
sed -i "s/read /confirm=y; #read /g" install-playsms.sh
sudo ./install-playsms.sh
cd $MY_PATH
##kopa sudo rm -rf playsms
@ -86,11 +92,8 @@ manageSSL() {
install_certbot(){
sudo apt update
if [[ $(grep buster /etc/os-release) ]]; then
[[ -z $(cat /etc/apt/sources.list | grep "buster-backports main") ]] && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
sudo apt install certbot python-certbot-nginx -t buster-backports -y
elif [[ $(grep stretch /etc/os-release) ]]; then
sudo apt install certbot python-certbot-nginx -y
if [[ $(grep -E 'stretch|buster' /etc/os-release) ]]; then
sudo apt install certbot python-certbot-nginx -y
elif [[ $(grep -E '16.|17.|18.|19.' /etc/os-release) ]]; then
sudo apt install software-properties-common
sudo add-apt-repository universe
@ -136,8 +139,7 @@ manageSSL() {
}
echo -e "${c_yellow}playSMS ne fonctionne pas sans certifcat SSL.$c_"
printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_"
read askSSL
[[ ! $noask ]] && printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $PSMS_DOMAIN ? (o/n) $c_" && read askSSL
if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then
manageSSL certif
if sudo test -f /etc/letsencrypt/live/$PSMS_DOMAIN/fullchain.pem; then manageSSL on; else manageSSL off && echo "Une erreur s'est produite, basculement vers le mode non SSL"; fi

View File

@ -66,8 +66,6 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
sed -i s/au\ G1FabLab\ de\ Toulouse/$ADRESSE/g $init_loc
sed -i s/+33647683646/$ADMINPHONE/g $init_loc
sed -i s/Fred/$ADMINPSEUDO/g $init_loc
cat $init_loc || err=1
else
echo -e "${c_red}init.sh introuvable...$c_"
err=1