From 3236d16220e1917c625c06ad34e22abec76b0957 Mon Sep 17 00:00:00 2001 From: Toerd Date: Sat, 15 Sep 2018 23:13:20 +0200 Subject: [PATCH] Fixed bugs --- fresh.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fresh.sh b/fresh.sh index 2a0f024..b042b39 100755 --- a/fresh.sh +++ b/fresh.sh @@ -1,14 +1,16 @@ #!/bin/bash +logfile="/dev/null" + # Get params -while getopts "r:p:d:v:h" opt; +while getopts "r:p:d:vh" opt; do case $opt in h) echo -e "-r: https://link-to-repo\n-p: /link/to/prog/file\n-d: devicename for special dotfiles\n-v: verbose, please supply logfile path (default is $HOME/install.log)" && exit ;; d) device=${OPTARG} ;; r) repo=${OPTARG} && git ls-remote "$repo" || exit ;; p) prog=${OPTARG} ;; a) aurhelper=${OPTARG} ;; - v) logfile=${OPTARG} ;; + v) logfile="$scriptdir/install.log" ;; \?) echo "-$OPTARG is not valid" >&2 && exit ;; esac done @@ -18,11 +20,7 @@ device=${device:="480"} repo=${repo:="https://toerd@bitbucket.org/toerd/dotfiles"} prog=${prog:="$scriptdir/pack.list"} aurhelper=${aurhelper:="yay"} -logfile=${logfile:="$scriptdir/install.log"} -if [ -z ${v+x} ]; then - logfile="/dev/null" -fi startup_msg() { curr_platform=$(dialog --clear --title "Welcome to the installer <3" --menu "Choose your current platform:" 0 0 2 "L" "Laptop" "D" "Desktop" 2>&1>/dev/tty) @@ -65,19 +63,22 @@ create_user() { } install_pacman() { - dialog --title "Pacman packages" --infobox "Package $n/$ps\n\nInstalling: $1\n\n> $2 <" 0 0 + psd=$((psd+1)) + dialog --title "Pacman packages" --infobox "Package $psd/$ps\n\nInstalling: $1\n\n> $2 <" 0 0 pacman --noconfirm --needed -S "$1" &>$logfile } install_aur() { - dialog --title "AUR packages" --infobox "AUR Package $n/$as\n\nInstalling: $1\n\n> $2 <" 0 0 + asd=$((asd+1)) + dialog --title "AUR packages" --infobox "AUR Package $asd/$as\n\nInstalling: $1\n\n> $2 <" 0 0 # is package already installed? grep "^$1$" <<< "$aur_already_installed" && return sudo -u $uname $aurhelper -S --noconfirm "$1" $>$logfile } install_manual() { - dialog --title "Manual packages" --infobox "Manual Package $n/$ms\n\nInstalling: $1\n\n> $2 <" 0 0 + msd=$((msd+1)) + dialog --title "Manual packages" --infobox "Manual Package $msd/$ms\n\nInstalling: $1\n\n> $2 <" 0 0 cd "$scriptdir/packages/$1" || exit make clean && make && sudo -u $uname make install &>$logfile ; cd "/home/$uname" || exit @@ -102,7 +103,6 @@ installation_loop() { aur_already_installed=$(pacman -Qqm) #IFS separator while IFS=, read -r platform prefix program info; do - n=$((n+1)) if [[ ${platform} != "A" ]] && [[ ${platform} != ${curr_plattform} ]]; then continue