|
|
|
@ -1,13 +1,12 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# TODO: count of packages depending on selected platform
|
|
|
|
|
# TODO: function to place udev rules
|
|
|
|
|
|
|
|
|
|
scriptdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
|
logfile="/dev/null"
|
|
|
|
|
todo="install"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get params
|
|
|
|
|
while getopts "r:p:d:vh" opt;
|
|
|
|
|
while getopts "r:p:d:vuh" 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} ;;
|
|
|
|
@ -15,6 +14,7 @@ do case $opt in
|
|
|
|
|
p) prog=${OPTARG} ;;
|
|
|
|
|
a) aurhelper=${OPTARG} ;;
|
|
|
|
|
v) logfile="$scriptdir/install.log" ;;
|
|
|
|
|
u) todo="update" ;;
|
|
|
|
|
\?) echo "-$OPTARG is not valid" >&2 && exit ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
@ -26,14 +26,18 @@ aurhelper=${aurhelper:="yay"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
echo "Installation started - Platform is: $curr_platform\n\n" >> $logfile
|
|
|
|
|
curr_platform=$(dialog --clear --title "Welcome to the Freshcript <3" --menu "Choose your current platform:" 0 0 2 "L" "Laptop" "D" "Desktop" 2>&1>/dev/tty)
|
|
|
|
|
echo "Script started - Platform is: $curr_platform\n\n" >> $logfile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init() {
|
|
|
|
|
pacman -S --noconfirm --needed dialog git make || { echo "Run as root user"; exit; }
|
|
|
|
|
dialog --infobox "Refresh of the Keyring" 0 0
|
|
|
|
|
refresh_keyring
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
refresh_keyring() {
|
|
|
|
|
pacman --noconfirm -Sy archlinux-keyring &>> $logfile
|
|
|
|
|
dialog --infobox "Refresh of the Keyring" 0 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pre_install() {
|
|
|
|
@ -41,6 +45,12 @@ pre_install() {
|
|
|
|
|
echo "Automatic part started\n\n" >> $logfile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pre_update() {
|
|
|
|
|
uname=$(logname)
|
|
|
|
|
dialog --title "Start the Update" --yes-label "Okey Dokey Artischokey" --no-label "NOPE Byeee" --yesno "\nUpdateriniho as user > $uname <" 0 0 || { clear; exit; }
|
|
|
|
|
echo "Automatic update started as user:$uname\n\n" >> $logfile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get_credentials() {
|
|
|
|
|
uname=$(dialog --inputbox "Enter an username" 0 0 2>&1 1>/dev/tty)
|
|
|
|
|
echo $uname
|
|
|
|
@ -84,7 +94,7 @@ install_manual() {
|
|
|
|
|
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 && make install &>> $logfile ;
|
|
|
|
|
make clean && make && make install && make clean&>> $logfile ;
|
|
|
|
|
cd "/home/$uname" || exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -100,9 +110,10 @@ install_aur_helper() {
|
|
|
|
|
installation_loop() {
|
|
|
|
|
echo "Entered installationloop\n\n" >> $logfile
|
|
|
|
|
([ -f "$prog" ] && cp "$prog" /tmp/pack.csv) || curl -Ls "$prog" > /tmp/pack.csv
|
|
|
|
|
ps=$(grep -e ",P," /tmp/pack.csv | wc -l)
|
|
|
|
|
as=$(grep -e ",A," /tmp/pack.csv | wc -l)
|
|
|
|
|
ms=$(grep -e ",M," /tmp/pack.csv | wc -l)
|
|
|
|
|
# count packages and sum results for all and curr platform
|
|
|
|
|
ps=$(($(grep -e "A,P," /tmp/pack.csv | wc -l) + $(grep -e "$curr_platform,P," /tmp/pack.csv | wc -l)))
|
|
|
|
|
as=$(($(grep -e "A,A," /tmp/pack.csv | wc -l) + $(grep -e "$curr_platform,A," /tmp/pack.csv | wc -l)))
|
|
|
|
|
ms=$(($(grep -e "A,M," /tmp/pack.csv | wc -l) + $(grep -e "$curr_platform,M," /tmp/pack.csv | wc -l)))
|
|
|
|
|
aur_already_installed=$(pacman -Qqm)
|
|
|
|
|
#IFS separator
|
|
|
|
|
while IFS=, read -r platform prefix program info; do
|
|
|
|
@ -193,6 +204,8 @@ set_system_stuff() {
|
|
|
|
|
}
|
|
|
|
|
# ACTUAL ROUTINE
|
|
|
|
|
|
|
|
|
|
case $todo in
|
|
|
|
|
install)
|
|
|
|
|
init
|
|
|
|
|
startup_msg
|
|
|
|
|
get_credentials
|
|
|
|
@ -205,5 +218,18 @@ download_dotfiles
|
|
|
|
|
set_permissions "%wheel ALL=(ALL) ALL\\n%wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/packer -Syu,/usr/bin/packer -Syyu,/usr/bin/systemctl restart NetworkManager,/usr/bin/rc-service NetworkManager restart,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/yay"
|
|
|
|
|
no_beep
|
|
|
|
|
set_system_stuff
|
|
|
|
|
enable_service "--user syncthing" "netctl-auto@wlp3s0"
|
|
|
|
|
ready_steady_go
|
|
|
|
|
clear
|
|
|
|
|
;;
|
|
|
|
|
update)
|
|
|
|
|
init
|
|
|
|
|
startup_msg
|
|
|
|
|
refresh_keyring
|
|
|
|
|
pre_update
|
|
|
|
|
installation_loop
|
|
|
|
|
set_system_stuff
|
|
|
|
|
ready_steady_go
|
|
|
|
|
clear
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|