Added legacy menu and apt.list generator for options

This commit is contained in:
bprieshof
2019-11-28 14:16:35 +01:00
parent 3948b5a095
commit e7c9f3bfcb

View File

@@ -76,6 +76,25 @@ echo "Please enter your password (should contain at least 2 digits and 6 charact
read password
echo "Administrator E-mail:"
read email
echo "Select Webserver:"
PS3='Selected:'
options=("Nginx" "Apache" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Nginx")
webserv=Nginx:
break;;
"Apache")
webserv=Apache:
break;;
"Quit")
exit;;
*) echo "$REPLY is not a valid option!";;
esac
done
fi
webserv="${webserv//:}" && webserv="${webserv,,}"
@@ -97,7 +116,41 @@ if [ $IMODE = n ]; then
option=$(whiptail --nocancel --title "Which Nginx addons should be installed?" --checklist "Features" 11 110 5 "Memcached:" "Memcached is an open source, high-performance, distributed memory caching system." OFF "Redis Cache:" "Redis is an open source BSD licensed, in-memory data structure store." OFF 3>&1 1>&2 2>&3)
fi
if [ $IMODE = l ]; then
#L mode selector option
choice () {
local choice=$1
if [[ ${opts[choice]} ]] # toggle
then
opts[choice]=
else
opts[choice]=+
fi
}
PS3='Which Nginx addons should be installed?'
while :
do
clear
options=("Memcached ${opts[1]}" "Redis Cache ${opts[2]}" "Done")
select opt in "${options[@]}"
do
case $opt in
"Memcached ${opts[1]}")
choice 1
option="$option Memcache:"
break
;;
"Redis Cache ${opts[2]}")
choice 2
option="$option Redis Cache:"
break
;;
"Done")
break 2
;;
*) printf '%s\n' 'invalid option';;
esac
done
done
fi
fi
@@ -107,24 +160,53 @@ if [ $IMODE = n ]; then
option=$(whiptail --nocancel --title "Which Apache addons should be installed?" --checklist "Features" 11 110 5 "Memcached:" "Memcached is an open source, high-performance, distributed memory caching system." OFF "Redis Cache:" "Redis is an open source BSD licensed, in-memory data structure store." OFF 3>&1 1>&2 2>&3)
fi
if [ $IMODE = l ]; then
#L mode selector option
choice () {
local choice=$1
if [[ ${opts[choice]} ]] # toggle
then
opts[choice]=
else
opts[choice]=+
fi
}
PS3='Which Apache addons should be installed?'
while :
do
clear
options=("Memcached ${opts[1]}" "Redis Cache ${opts[2]}" "Done")
select opt in "${options[@]}"
do
case $opt in
"Memcached ${opts[1]}")
choice 1
option="$option Memcache:"
break
;;
"Redis Cache ${opts[2]}")
choice 2
option="$option Redis Cache:"
break
;;
"Done")
break 2
;;
*) printf '%s\n' 'invalid option';;
esac
done
done
fi
fi
option="${option// /}" && option="${option/:/ }" && option="${option//:}" && option="${option,,}" && option="${option//'"'}"
if [[ $option == *"Memcached:"* ]]; then
#curl -s "$repo"/raw/branch/"$branch"/modules/MODNAME/"$webserv"-aptlist >> /tmp/install.txt
echo "php-memcached" >> /tmp/install.txt
fi
echo "Generating Apt List for options"
for val1 in ${option[*]}; do
echo $val1 #TMP
curl "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"/apt.list >>/tmp/apt.list
curl "$repo"/raw/branch/"$branch"/SubModules/"$val1"/common/apt.list >>/tmp/apt.list
if [[ $option == *"Redis"* ]]; then
echo "redis-server" >> /tmp/install.txt
fi
if [[ $option == *"Brotli:"* ]]; then
echo "" >> /tmp/install.txt
fi
done
##-------##
@@ -135,8 +217,29 @@ CMS=$(whiptail --nocancel --title "What CMS should be installed?" --radiolist "F
fi
if [ $IMODE = l ]; then
#L mode selector for CMS
echo "What CMS should be installed?"
PS3='Selected:'
options=("Nextcloud" "Wordpress" "None")
select opt in "${options[@]}"
do
case $opt in
"Nextcloud")
CMS=Nextcloud:
break;;
"Wordpress")
CMS=Wordpress:
break;;
"None")
CMS=None:
break;;
*) echo "$REPLY is not a valid option!";;
esac
done
fi
curl "$repo"/raw/branch/"$branch"/CMS/"$CMS"/$webserv/apt.list >>/tmp/apt.list
curl "$repo"/raw/branch/"$branch"/CMS/"$CMS"/apt.list >>/tmp/apt.list
if [[ $CMS == "Nextcloud:" ]]; then
echo "libxml2 openssl zlib1g libpng-dev redis-server" >> /tmp/install.txt