master
Toerd 6 years ago
parent 2ff6f04d16
commit 3236d16220

@ -1,14 +1,16 @@
#!/bin/bash #!/bin/bash
logfile="/dev/null"
# Get params # Get params
while getopts "r:p:d:v:h" opt; while getopts "r:p:d:vh" opt;
do case $opt in 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 ;; 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} ;; d) device=${OPTARG} ;;
r) repo=${OPTARG} && git ls-remote "$repo" || exit ;; r) repo=${OPTARG} && git ls-remote "$repo" || exit ;;
p) prog=${OPTARG} ;; p) prog=${OPTARG} ;;
a) aurhelper=${OPTARG} ;; a) aurhelper=${OPTARG} ;;
v) logfile=${OPTARG} ;; v) logfile="$scriptdir/install.log" ;;
\?) echo "-$OPTARG is not valid" >&2 && exit ;; \?) echo "-$OPTARG is not valid" >&2 && exit ;;
esac esac
done done
@ -18,11 +20,7 @@ device=${device:="480"}
repo=${repo:="https://toerd@bitbucket.org/toerd/dotfiles"} repo=${repo:="https://toerd@bitbucket.org/toerd/dotfiles"}
prog=${prog:="$scriptdir/pack.list"} prog=${prog:="$scriptdir/pack.list"}
aurhelper=${aurhelper:="yay"} aurhelper=${aurhelper:="yay"}
logfile=${logfile:="$scriptdir/install.log"}
if [ -z ${v+x} ]; then
logfile="/dev/null"
fi
startup_msg() { 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) 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() { 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 pacman --noconfirm --needed -S "$1" &>$logfile
} }
install_aur() { 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? # is package already installed?
grep "^$1$" <<< "$aur_already_installed" && return grep "^$1$" <<< "$aur_already_installed" && return
sudo -u $uname $aurhelper -S --noconfirm "$1" $>$logfile sudo -u $uname $aurhelper -S --noconfirm "$1" $>$logfile
} }
install_manual() { 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 cd "$scriptdir/packages/$1" || exit
make clean && make && sudo -u $uname make install &>$logfile ; make clean && make && sudo -u $uname make install &>$logfile ;
cd "/home/$uname" || exit cd "/home/$uname" || exit
@ -102,7 +103,6 @@ installation_loop() {
aur_already_installed=$(pacman -Qqm) aur_already_installed=$(pacman -Qqm)
#IFS separator #IFS separator
while IFS=, read -r platform prefix program info; do while IFS=, read -r platform prefix program info; do
n=$((n+1))
if [[ ${platform} != "A" ]] && [[ ${platform} != ${curr_plattform} ]]; then if [[ ${platform} != "A" ]] && [[ ${platform} != ${curr_plattform} ]]; then
continue continue

Loading…
Cancel
Save