mirror of
https://github.com/bashclub/zamba-lxc-toolbox.git
synced 2024-11-07 19:31:58 +01:00
Replaced while loops with more safe for loops
This commit is contained in:
parent
73e68efc7a
commit
2d701d4df2
21
install.sh
21
install.sh
@ -21,10 +21,10 @@ usage() {
|
|||||||
cat >&2 <<-EOF
|
cat >&2 <<-EOF
|
||||||
usage: $prog [-h] [-i CTID] [-s SERVICE] [-c CFGFILE]
|
usage: $prog [-h] [-i CTID] [-s SERVICE] [-c CFGFILE]
|
||||||
installs a preconfigured lxc container on your proxmox server
|
installs a preconfigured lxc container on your proxmox server
|
||||||
-h displays this help text
|
|
||||||
-i CTID provide a container id instead of auto detection
|
-i CTID provide a container id instead of auto detection
|
||||||
-s SERVICE provide the service name and skip the selection dialog
|
-s SERVICE provide the service name and skip the selection dialog
|
||||||
-c CFGFILE use a different config file than 'zamba.conf'
|
-c CFGFILE use a different config file than 'zamba.conf'
|
||||||
|
-h displays this help text
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
(C) 2021 zamba-lxc-toolbox by bashclub (https://github.con/bashclub)
|
(C) 2021 zamba-lxc-toolbox by bashclub (https://github.con/bashclub)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
@ -35,7 +35,8 @@ usage() {
|
|||||||
|
|
||||||
ctid=0
|
ctid=0
|
||||||
service=ask
|
service=ask
|
||||||
config=$PWD/zamba.conf
|
config=$PWD/conf/zamba.conf
|
||||||
|
verbose=0
|
||||||
|
|
||||||
while getopts "hi:s:c:" opt; do
|
while getopts "hi:s:c:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
@ -54,15 +55,15 @@ source $config
|
|||||||
|
|
||||||
OPTS=$(ls -d $PWD/src/*/ | grep -v __ | xargs basename -a)
|
OPTS=$(ls -d $PWD/src/*/ | grep -v __ | xargs basename -a)
|
||||||
|
|
||||||
echo 0 > $PWD/VALIDATION
|
valid=0
|
||||||
if [[ "$service" == "ask" ]]; then
|
if [[ "$service" == "ask" ]]; then
|
||||||
select svc in $OPTS quit; do
|
select svc in $OPTS quit; do
|
||||||
if [[ "$svc" != "quit" ]]; then
|
if [[ "$svc" != "quit" ]]; then
|
||||||
echo -e "$OPTS" | while read line; do
|
for line in $(echo $OPTS); do
|
||||||
if [[ "$svc" == "$line" ]]; then
|
if [[ "$svc" == "$line" ]]; then
|
||||||
service=$svc
|
service=$svc
|
||||||
echo "Installation of $service selected."
|
echo "Installation of $service selected."
|
||||||
echo 1 > $PWD/VALIDATION
|
valid=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -70,27 +71,25 @@ if [[ "$service" == "ask" ]]; then
|
|||||||
echo "Selected 'quit' exiting without action..."
|
echo "Selected 'quit' exiting without action..."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [[ "$(cat $PWD/VALIDATION)" == "1" ]]; then
|
if [[ "$valid" == "1" ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo -e "$OPTS" | while read line; do
|
for line in $(echo $OPTS); do
|
||||||
if [[ "$service" == "$line" ]]; then
|
if [[ "$service" == "$line" ]]; then
|
||||||
echo "Installation of $service selected."
|
echo "Installation of $service selected."
|
||||||
echo 1 > $PWD/VALIDATION
|
valid=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$(cat $PWD/VALIDATION)" != "1" ]]; then
|
if [[ "$valid" != "1" ]]; then
|
||||||
echo "Invalid option, exiting..."
|
echo "Invalid option, exiting..."
|
||||||
usage 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $PWD/VALIDATION
|
|
||||||
|
|
||||||
source $PWD/src/$service/constants-service.conf
|
source $PWD/src/$service/constants-service.conf
|
||||||
|
|
||||||
# CHeck is the newest template available, else download it.
|
# CHeck is the newest template available, else download it.
|
||||||
|
Loading…
Reference in New Issue
Block a user