Compare commits

..

No commits in common. "6f9736d0bd3c5fc4ae5815608afe2fe938c9d7d9" and "58fb73a9da733d31daeb13f3e19d424aa31bb92d" have entirely different histories.

2 changed files with 58 additions and 74 deletions

View File

@ -1,28 +1,17 @@
#!/bin/bash
# Author: Philip Gaber <phga@posteo.de>
me=$(basename "$0")
scriptdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
help_msg="\nUsage: $me [OPTIONS]\n\n
Examples:\n\n $ $me -l -u\n\n
Options:\n
-d GIT_DOTFILES_REPO_URL (e.g. https://user@gitmebabyonemoretime.com/user/dotfiles)\n
-p PACKAGE_CSV_FILE (e.g. ./pack.csv)\n
-a AURHELPER (e.g. yay)\n
-l LOGFILE (default: $HOME/install.log)\n
-u Update the current system\n
-s Enable necessary services on the current system\n
"
# Get params
while getopts "r:p:d:vush" opt;
do case $opt in
h) echo -e $help_msg && exit ;;
d) dotfiles=${OPTARG} && git ls-remote "$repo" || exit ;;
p) pack_csv=${OPTARG} ;;
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} ;;
l) logfile="$scriptdir/install.log" ;;
v) logfile="$scriptdir/install.log" ;;
u) todo="update" ;;
s) todo="services" ;;
\?) echo "-$OPTARG is not valid" >&2 && exit ;;
@ -30,8 +19,9 @@ do case $opt in
done
# Default settings
dotfiles=${dotfiles:="https://phga@g.phga.de/phga/dotfiles"}
pack_csv=${pack_csv:="$scriptdir/pack.csv"}
device=${device:="480"}
repo=${repo:="https://phga@g.phga.de/phga/dotfiles"}
prog=${prog:="$scriptdir/pack.csv"}
aurhelper=${aurhelper:="yay"}
logfile=${logfile:="/dev/null"}
todo=${todo:="install"}
@ -39,15 +29,12 @@ todo=${todo:="install"}
startup_msg() {
curr_platform=$(dialog --clear --title "Welcome to the Freshcript <3" --menu "Choose your current platform:" 0 0 3 "L" "Laptop" "D" "Desktop" "S" "Server" 2>&1>/dev/tty)
[ -z "$curr_platform" ] && { clear; exit; }
echo "Script started - Platform is: $curr_platform\n\n" >> $logfile
}
wait_for_network() {
dialog --infobox "Waiting for internet connection...\n\nDumdidum dum dumdiii dum" 0 0
ping -c 1 -q "one.one.one.one" >> $logfile && return || dhcpcd >> $logfile
dhcpcd >> $logfile
while [ ! $OK = 0 ]; do
ping -c 1 -q "one.one.one.one" >> $logfile && OK=$?
done
@ -55,8 +42,7 @@ wait_for_network() {
init() {
wait_for_network
pacman -S --noconfirm --needed dialog git make > /dev/null 2>&1 ||
{ echo "Run as root user"; clear; exit; }
pacman -S --noconfirm --needed dialog git make || { echo "Run as root user"; clear; exit; }
refresh_keyring
}
@ -123,50 +109,45 @@ install_manual() {
cd "/home/$uname" || exit
}
# TODO: test with makepkg -si
install_aur_helper() {
dialog --title "Installing the AUR Helper" --infobox "Installing dependencies..." 0 0
pacman --noconfirm --needed -S go &>> $logfile
dialog --title "Installing the AUR Helper" --infobox "Cloning repository..." 0 0
cd $(sudo -u $uname mktemp -d)
git clone "https://aur.archlinux.org/$aurhelper.git" . &>> $logfile
sudo -u $uname makepkg --noconfirm -s &>> $logfile
pacman -U --noconfirm *.zst
# Check if aurhelper installation was successful
if ! hash $aurhelper > /dev/null 2>&1; then
dialog --title "Installing the AUR Helper" --infobox \
"Installation of $aurhelper failed" 0 0
sleep 10
clear
exit
fi
git clone https://aur.archlinux.org/yay.git . &>> $logfile
sudo -u $uname makepkg --noconfirm -si &>> $logfile
# pacman -U --noconfirm *.zst
}
installation_loop() {
echo "Entered installationloop\n\n" >> $logfile
csv="/tmp/pack.csv"
([ -f "$pack_csv" ] && cp "$pack_csv" "$csv") || curl -Ls "$pack_csv" > "$csv"
([ -f "$prog" ] && cp "$prog" /tmp/pack.csv) || curl -Ls "$prog" > /tmp/pack.csv
# count packages and sum results for all and curr platform
ps=$(($(grep -e "A,P," "$csv" | wc -l) + $(grep -e "$curr_platform,P," "$csv" | wc -l)))
as=$(($(grep -e "A,A," "$csv" | wc -l) + $(grep -e "$curr_platform,A," "$csv" | wc -l)))
ms=$(($(grep -e "A,M," "$csv" | wc -l) + $(grep -e "$curr_platform,M," "$csv" | wc -l)))
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)
# For all lines in pack.csv do
#IFS separator
while IFS=, read -r platform prefix program info; do
[[ ${platform} != "A" ]] && [[ ${platform} != ${curr_platform} ]] && continue
if [[ ${platform} != "A" ]] && [[ ${platform} != ${curr_platform} ]]; then
continue
fi
case $prefix in
P) install_pacman "$program" "$info" ;;
A) install_aur "$program" "$info" ;;
M) install_manual "$program" "$info" ;;
esac
done < "$csv"
done < /tmp/pack.csv
}
enable_service() {
for service in "$@"; do
dialog --infobox "Enabling: $service" 0 0
if [[ $@ =~ "--user.*" ]]; then
if [[ $@ =~ "--user.*" ]]
then
sudo -u $uname systemctl enable "$service"
sudo -u $uname systemctl start "$service"
else
@ -186,7 +167,7 @@ set_permissions() {
download_dotfiles() {
cd /home/$uname
sudo -u $uname mkdir -p .dotfiles && cd .dotfiles
sudo -u $uname git clone $dotfiles .
sudo -u $uname git clone $repo .
sudo -u $uname ./scripts/link.sh
echo "Dotfiles downloaded and installed\n\n" >> $logfile
}
@ -198,8 +179,22 @@ no_beep() {
}
ready_steady_go() {
dialog --title "WE ARE DONE" --msgbox "The installation is complete\n\n#fingerscrossed
everything worked :D\n\nTODOs\n\n- Move syncthing keys into .config\n" 0 0 ;
dialog --title "WE ARE DONE" --msgbox "The installation is complete\n\n#fingerscrossed everything worked :D\n\nTODOs\n\n- Move syncthing keys into .config\n" 0 0 ;
}
uncom() {
sed -i '/'"$1"'/s/^#//g' $2
}
com() {
sed -i '/'"$1"'/s/^/#/g' $2
}
add_after() {
# Example:
# add_after "Color" "ILoveCandy" "$HOME/test/pacman.conf"
sed -i '/'"$2"'/d'
sed -i '/'"$1"'/a '"$2"'' $3
}
add_xorg_conf() {
@ -218,9 +213,9 @@ add_pacman_hooks() {
cp $scriptdir/etc/pacman.d/hooks/* /etc/pacman.d/hooks/ &>> $logfile
}
add_systemd_conf() {
add_xorg_conf() {
echo "Adding systemd configs\n\n" >> $logfile
cp -r $scriptdir/etc/systemd/* /etc/systemd/ &>> $logfile
cp $scriptdir/etc/systemd/network/00-wired.network /etc/systemd/network/00-wired.network &>> $logfile
}
set_pacman_config() {
@ -249,7 +244,6 @@ set_system_stuff() {
set_pacman_config
add_pacman_hooks
add_xorg_conf
add_systemd_conf
set_git_config
#link syncthing config and move certs
# sudo -u $uname /home/$uname/.dotfiles/syncthing/link-confs.sh &>> $logfile
@ -306,7 +300,7 @@ case $todo in
set_permissions "Defaults timestamp_timeout=45\n%wheel ALL=(ALL) ALL\n%wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend"
no_beep
set_system_stuff
enable_service "--user syncthing" "--user pipewire-pulse"
enable_service "--user syncthing"
if [[ ${curr_platform} == "L" ]]; then
enable_service "netctl-auto@wlp3s0"
else
@ -337,7 +331,7 @@ case $todo in
else
enable_service "systemd-networkd"
fi
enable_service "systemd-timesyncd" "atd" "--user syncthing" "--user pipewire-pulse"
enable_service "systemd-timesyncd" "atd"
ready_steady_go
clear
;;

View File

@ -91,31 +91,21 @@ A,P,redshift,No more burning eyes at night <3
A,P,alsa-plugins,Extra alsa plugins
A,P,alsa-utils,An alternative implementation of Linux sound support
A,P,blueman,Bluetooth manager
### PULSEAUDIO / JACK2
# A,A,apulse,Compatibility layer for applications that rely on pulseaudio
# A,P,pulseaudio,Sound server
# A,P,pulseaudio-alsa,ALSA Configuration for PulseAudio
# A,P,pavucontrol-qt,GUI to manage PulseAudio
A,P,pulseaudio,Sound server
A,P,pulseaudio-alsa,ALSA Configuration for PulseAudio
A,P,pavucontrol-qt,GUI to manage PulseAudio
# D,P,pulseaudio-jack,Jack support for PulseAudio
# D,P,jack2,C++ version of the JACK low-latency audio server for multi-processor machines
# D,P,jack2-dbus,The JACK low-latency audio server (dbus integration)
# D,P,a2jmidid,Dbus midi jack thingy
# D,P,qjackctl,A Qt front-end for the JACK low-latency audio server
# D,P,python-dbus,Python bindings for DBUS
# D,P,realtime-privileges,Required for realtime applications
D,P,pulseaudio-jack,Jack support for PulseAudio
D,P,jack2,C++ version of the JACK low-latency audio server for multi-processor machines
D,P,jack2-dbus,The JACK low-latency audio server (dbus integration)
D,P,a2jmidid,Dbus midi jack thingy
D,P,qjackctl,A Qt front-end for the JACK low-latency audio server
D,P,python-dbus,Python bindings for DBUS
D,P,realtime-privileges,Required for realtime applications
# A,P,pulseaudio-bluetooth,Bluetooth support for PulseAudio
### PIPEWIRE
A,P,pipewire,Low-latency audio/video router and processor
A,P,pipewire-pulse,PulseAudio replacement
A,P,pipewire-alsa,ALSA configuration
A,P,pipewire-jack,JACK support
A,P,wireplumber,Session and policy manager implementation for PipeWire
A,P,qpwgraph,PipeWire Graph Qt GUI Interface
A,P,blueman,Bluetooth manager
A,P,pulseaudio-bluetooth,Bluetooth support for PulseAudio
# Text editing
A,P,emacs,The extensible customizable self-documenting real-time display editor

1 # First column: A = All, L = Laptop, D = Desktop
91 # D,P,a2jmidid,Dbus midi jack thingy D,P,python-dbus,Python bindings for DBUS
92 # D,P,qjackctl,A Qt front-end for the JACK low-latency audio server D,P,realtime-privileges,Required for realtime applications
93 # D,P,python-dbus,Python bindings for DBUS A,P,blueman,Bluetooth manager
# D,P,realtime-privileges,Required for realtime applications
# A,P,pulseaudio-bluetooth,Bluetooth support for PulseAudio
### PIPEWIRE
94 A,P,pipewire,Low-latency audio/video router and processor A,P,pulseaudio-bluetooth,Bluetooth support for PulseAudio
95 A,P,pipewire-pulse,PulseAudio replacement # Text editing
96 A,P,pipewire-alsa,ALSA configuration A,P,emacs,The extensible customizable self-documenting real-time display editor
97 A,P,pipewire-jack,JACK support A,P,xournalpp,Notetaking and sketching application
98 A,P,wireplumber,Session and policy manager implementation for PipeWire # emacs reqs
99 A,P,qpwgraph,PipeWire Graph Qt GUI Interface A,P,pandoc,A universal document converter
100 # Text editing A,P,auctex,latexpreview
101 A,P,emacs,The extensible customizable self-documenting real-time display editor A,P,texlive-core,latex export (orgmode)
102 A,P,xournalpp,Notetaking and sketching application A,P,texlive-latexextra,latex export (orgmode)
103 # emacs reqs A,P,texlive-bibtexextra,Latex biblatex support
104 A,P,pandoc,A universal document converter A,P,texlive-science,Latex Math support
105 A,P,auctex,latexpreview A,P,texlive-fontsextra,More latex fonts
106 A,P,texlive-core,latex export (orgmode) A,P,biber,Citation for latex (new backend)
107 A,P,texlive-latexextra,latex export (orgmode) A,P,minted,Syntaxhighlighting for Latex
108 A,P,texlive-bibtexextra,Latex biblatex support # Mail -> GNUS
A,P,texlive-science,Latex Math support
A,P,texlive-fontsextra,More latex fonts
A,P,biber,Citation for latex (new backend)
A,P,minted,Syntaxhighlighting for Latex
# Mail -> GNUS
# A,A,mu,Maildir indexer/searcher and Emacs client (mu4e)
# A,P,offlineimap,Synchronizes emails between two repositories
109 # A,P,claws-mail,Mailclient written in C # A,A,mu,Maildir indexer/searcher and Emacs client (mu4e)
110 # Webbrowsing # A,P,offlineimap,Synchronizes emails between two repositories
111 A,P,qutebrowser,A keyboard-driven vim-like browser based on PyQt5 # A,P,claws-mail,Mailclient written in C