added update functionality to the fresh script + packs added

master
toerd 6 years ago
parent e35a11a1e3
commit b9623862a4

@ -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,17 +204,32 @@ set_system_stuff() {
}
# ACTUAL ROUTINE
init
startup_msg
get_credentials
pre_install
create_user
set_permissions "%wheel ALL=(ALL) NOPASSWD: ALL"
install_aur_helper
installation_loop
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
ready_steady_go
clear
case $todo in
install)
init
startup_msg
get_credentials
pre_install
create_user
set_permissions "%wheel ALL=(ALL) NOPASSWD: ALL"
install_aur_helper
installation_loop
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

@ -13,7 +13,6 @@ A,P,xfsprogs,XFS filesystem utilities
A,P,intel-ucode,Microcode update files for Intel CPUs
L,P,acpi,Client for battery power and thermal readings
L,P,acpid,A daemon for delivering ACPI power management events with netlink support
A,P,pulseaudio,A featureful general-purpose sound server
A,P,openssh,ssh
# Package management

1 # First column: A = All, L = Laptop, D = Desktop
13 L,P,acpi,Client for battery power and thermal readings
14 L,P,acpid,A daemon for delivering ACPI power management events with netlink support
15 A,P,pulseaudio,A featureful general-purpose sound server A,P,openssh,ssh
A,P,openssh,ssh
16 # Package management
17 A,P,reflector,sort mirrorlist
18 # Fonts
Loading…
Cancel
Save