From 0da11812af9b4c8aa263e42104c4e11db38923a0 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 22 Jun 2023 12:18:55 +0400 Subject: [PATCH] fix minor changes --- install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 42f3103..ffcbbb9 100755 --- a/install.sh +++ b/install.sh @@ -5,14 +5,14 @@ REQUIRED_PKGS=(file git bc) function usage() { echo 'usage: --host | --containers | --full | --one-container ' - exit -1 + exit 1 } function install_host() { echo "install on: $HOSTNAME" echo ---------------------- - [ $(id -u) -ne 0 ] && echo 'root privilege required' && exit 1 + [ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1 if [[ ! $CURDIR == '/opt/debian-bash' ]]; then # download and filfull /opt/debian-bash, then run it from folder @@ -24,14 +24,14 @@ function install_host() { rm -rf /opt/debian-bash TEMP=$(mktemp -d) - cd $TEMP - echo $TEMP + cd "$TEMP" || return + echo "$TEMP" wget https://git.artcode.re/pvincent/debian-bash/archive/master.tar.gz tar -xzf master.tar.gz mv debian-bash /opt/ - cd /opt/debian-bash - ./install.sh $PARAM1 - rm -rf $TEMP + cd /opt/debian-bash || return + ./install.sh "$PARAM1" + rm -rf "$TEMP" exit 0 fi @@ -50,7 +50,7 @@ function install_containers() { # install inside active LXC containers if [[ -f '/snap/bin/lxc' ]]; then for container in $(/snap/bin/lxc list --format=json | yq '.[] | select(.state.status == "Running") | .name' -); do - install_one_container $container + install_one_container "$container" echo done fi @@ -80,8 +80,8 @@ case $PARAM1 in ;; "--one-container") CT=$2 - if [ ! -z $CT ]; then - install_one_container $CT + if [ ! -z "$CT" ]; then + install_one_container "$CT" else usage fi