diff --git a/fresh.sh b/fresh.sh index 7eaf7ae..bbc2508 100755 --- a/fresh.sh +++ b/fresh.sh @@ -21,7 +21,7 @@ done device=${device:="480"} repo=${repo:="https://toerd@bitbucket.org/toerd/dotfiles"} -prog=${prog:="$scriptdir/pack.list"} +prog=${prog:="$scriptdir/pack.csv"} aurhelper=${aurhelper:="yay"} @@ -99,10 +99,10 @@ install_aur_helper() { installation_loop() { echo "Entered installationloop\n\n" >> $logfile - ([ -f "$prog" ] && cp "$prog" /tmp/pack.list) || curl -Ls "$prog" > /tmp/pack.list - ps=$(grep -e ",P," /tmp/pack.list | wc -l) - as=$(grep -e ",A," /tmp/pack.list | wc -l) - ms=$(grep -e ",M," /tmp/pack.list | wc -l) + ([ -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) aur_already_installed=$(pacman -Qqm) #IFS separator while IFS=, read -r platform prefix program info; do @@ -116,7 +116,7 @@ installation_loop() { A) install_aur "$program" "$info" ;; M) install_manual "$program" "$info" ;; esac - done < /tmp/pack.list + done < /tmp/pack.csv } enable_service() { @@ -152,12 +152,45 @@ ready_steady_go() { dialog --title "WE ARE DONE" --msgbox "The installation is complete\n\n#fingerscrossed everything worked :D" 0 0 ; } +uncom() { + sed -i '/'"$1"'/s/^#//g' $2 +} + +com() { + sed -i '/'"$1"'/s/^/#/g' $2 +} + +add_after() { + # Example: + # add_after "Color" 'tt="ILoveCandy"' "$HOME/test/pacman.conf" + # add_after "Color" 'tt="ILoveCandy"' "$HOME/test/pacman.conf" + sed -i '/'"$1"'/a '"$2"'' $3 +} + +add_udev_rules() { + cp "$scriptdir/udev/*" /etc/udev/rules.d/ +} + +add_pacman_hooks() { + mkdir -p /etc/pacman.d/hooks + cp "$scriptdir/pacman/hooks/*" /etc/pacman.d/hooks/ +} + +set_pacman_config() { + pconf="/etc/pacman.conf" + uncom "Color" $pconf + uncom "TotalDownload" $pconf + uncom "VerbosePkgLists" $pconf + add_after "VerbosePkgLists" "ILoveCandy" $pconf +} + set_system_stuff() { # locale gen - sudo localectl --no-convert set-x11-keymap us ,altgr-intl + localectl --no-convert set-x11-keymap us ,altgr-intl setxkbmap us -variant altgr-intl + set_pacman_conf + add_udev_rules } - # ACTUAL ROUTINE init @@ -172,6 +205,5 @@ 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 -sed -i "s/#Color^/Color/g" /etc/pacman.conf ready_steady_go clear diff --git a/pack.list b/pack.csv similarity index 97% rename from pack.list rename to pack.csv index 26c20ff..287dc0c 100644 --- a/pack.list +++ b/pack.csv @@ -16,6 +16,8 @@ L,P,acpid,A daemon for delivering ACPI power management events with netlink supp A,P,pulseaudio,A featureful general-purpose sound server A,P,openssh,ssh +# Package management +A,P,reflector,sort mirrorlist # Fonts A,A,nerd-fonts-hack,Systemfont @@ -70,6 +72,7 @@ A,P,pass,Stores retrieves generates and synchronizes passwords securely A,P,zip,Compressor/archiver for creating and modifying zipfiles A,P,p7zip,Command-line file archiver with high compression ratio A,P,ripgrep,A search tool that combines the usability of ag with the raw speed of grep +A,P,fzf,fuzzy bash completion # Tools A,P,flameshot,snipping tool for screenshots and stuff diff --git a/pacman/hooks/reflector.hook b/pacman/hooks/reflector.hook new file mode 100644 index 0000000..e86649f --- /dev/null +++ b/pacman/hooks/reflector.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = Package +Operation = Install +Operation = Upgrade +Target = pacman-mirrorlist + +[Action] +Description = Updating mirrorlist with reflector... +When = PostTransaction +Depends = reflector +Exec = sudo reflector --verbose --latest 40 --number 10 --sort rate --protocol https --save /etc/pacman.d/mirrorlist \ No newline at end of file