aboutsummaryrefslogtreecommitdiff
path: root/distro/arch.sh
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2025-11-25 15:04:40 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2025-11-25 15:04:40 -0500
commitc87f73273e3e8d6b4781207cc5f671f931f38bf6 (patch)
tree07a05f2241eb6b468b4796de0e1a5e736d0142ed /distro/arch.sh
parentc32b46b00ddfd41e58f0d4a3fb0ca96a0f09acb2 (diff)
parent6faf64c17a9fe1c5f5ab0f313c1d36c867097ad7 (diff)
downloaddotfiles-c87f73273e3e8d6b4781207cc5f671f931f38bf6.tar.gz
dotfiles-c87f73273e3e8d6b4781207cc5f671f931f38bf6.tar.xz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'distro/arch.sh')
-rwxr-xr-xdistro/arch.sh269
1 files changed, 210 insertions, 59 deletions
diff --git a/distro/arch.sh b/distro/arch.sh
index 55e0a31..72b5db4 100755
--- a/distro/arch.sh
+++ b/distro/arch.sh
@@ -1,16 +1,38 @@
#!/bin/sh
set -e
-if [ "$(id -u)" -ne 0 ] ; then
- echo "Run as root"
+if [ "$(id -u)" -eq 0 ] ; then
+ echo "Run as normal user w/ sudo access"
exit 1;
fi
+codedir="$HOME/scm"
+okshdir="${codedir}/pub/ibara-oksh"
+rivercfgdir="${codedir}/wl/rivercfg"
+yaydir="${codedir}/pub/yay"
+
+GRAPHICS="${GRAPHICS:-yes}"
+THUNDERBOLT="${THUNDERBOLT:-yes}"
+PACKAGES="${PACKAGES:-yes}"
+FONTS="${FONTS:-yes}"
+YAY="${YAY:-yes}"
+BRAVE="${BRAVE:-yes}"
+OKSH="${OKSH:-yes}"
+RIVER="${RIVER:-yes}"
+V4L2LOOPBACK="${V4L2LOOPBACK:-yes}"
+LOGIND="${LOGIND:-yes}"
+DWM="${DWM:-no}"
+DPW="${DPW:-yes}"
+
+dpwdir="${codedir}/me/dpw"
+dwmdir="${codedir}/x/dwm"
+dwmStdir="${codedir}/x/st"
+dwmDmenudir="${codedir}/x/dmenu"
+dwmSesdir="${codedir}/x/session"
+
pkgs="
alsa-utils
ansible
arandr
-avr-gcc
-avr-libc
base
base-devel
bind
@@ -23,7 +45,6 @@ chromium
cmake
colordiff
ctags
-docker
dosfstools
dunst
ed
@@ -32,6 +53,7 @@ ethtool
evince
evolution
exfat-utils
+fastfetch
feh
firefox
fuse
@@ -41,25 +63,18 @@ gdisk
gimp
git
git-lfs
-gpa
hdparm
htop
inkscape
iotop
iperf3
-jdk11-openjdk
-jdk8-openjdk
kdenlive
+less
libconfig # dmenu-pinentry
libfido2
libvirt # If you want
libxcb
libxkbcommon
-lightdm
-lightdm-gtk-greeter
-linux
-linux-firmware
-linux-zen
lvm2
lxappearance
man-pages
@@ -70,7 +85,6 @@ multipath-tools # kpartx
ncdu
ncmpc
ncspot
-neofetch
neovim
net-tools
networkmanager
@@ -101,17 +115,15 @@ qemu
qt5ct # https://wiki.archlinux.org/title/qt#Appearance
rclone
redshift
-rlwrap # used for clj
+ripgrep
rsync
scrot
+sddm
seahorse
shellcheck
-shellcheck
-sipcalc
smartmontools
speedtest-cli
swig # ykman
-the_silver_searcher
tmux
usbutils
v4l2loopback-dkms
@@ -123,7 +135,9 @@ whois
wireguard-tools
wireless_tools
wl-clipboard
-wlroots
+wlroots0.17
+wlroots0.18
+wlroots0.19
xclip
xdotool
xfce4
@@ -140,58 +154,195 @@ zathura-ps
zstd
"
+if [ "$PACKAGES" = "yes" ] ; then
#shellcheck disable=SC2046
-pacman -S --needed $(echo "$pkgs" | awk '{print $1}' | tr '\n' ' ')
+sudo pacman -S --needed $(echo "$pkgs" | awk '{print $1}' | tr '\n' ' ')
+fi
+if [ "$LOGIND" = "yes" ] ; then
fn="/etc/systemd/logind.conf"
bak="$fn.$(date +%s)"
-cp "$fn" "$bak"
-ed "$fn" <<EOF
-/^\[Login
-/^KillUserProcesses=
-d
-i
-KillUserProcesses=yes
-.
-/^HandleLidSwitch=
-d
-i
-HandleLidSwitch=ignore
-.
-w
-q
-EOF
-if diff -q "$fn" "$bak" >/dev/null ; then
- rm "$bak"
+sudo cp "$fn" "$bak"
+sudo sed -i -E -e 's/^.*KillUserProcesses=.*$/KillUserProcesses=yes/g' "$fn"
+sudo sed -i -E -e 's/^.*HandleLidSwitch=.*$/HandleLidSwitch=ignore/g' "$fn"
+if sudo diff -q "$fn" "$bak" >/dev/null ; then
+ sudo rm "$bak"
+fi
fi
+grep -q '^KillUserProcesses=yes' /etc/systemd/logind.conf || \
+ echo "You may want to set KillUserProcesses=yes in /etc/systemd/logind.conf"
+grep -q '^HandleLidSwitch=ignore' /etc/systemd/logind.conf || \
+ echo "You may want to set HandleLidSwitch=ignore in /etc/systemd/logind.conf"
-cat > /etc/udev/rules.d/99-removable.rules <<EOF
+if [ "$THUNDERBOLT" = "yes" ] ; then
+sudo sh -c 'cat > /etc/udev/rules.d/99-removable.rules <<EOF
# /etc/udev/rules.d/99-removable.rules
ACTION=="add", SUBSYSTEM=="thunderbolt", ATTR{authorized}=="0", ATTR{authorized}="1"
-EOF
-
+EOF'
+fi
-cat > /etc/pacman.d/hooks/95-bootbackup.hook <<EOF
-# /etc/pacman.d/hooks/95-bootbackup.hook
-[Trigger]
-Operation = Upgrade
-Operation = Install
-Operation = Remove
-Type = Path
-Target = usr/lib/modules/*/vmlinuz
-
-[Action]
-Depends = rsync
-Description = Backing up /boot...
-When = PostTransaction
-Exec = /bin/sh -c 'tar -C / -cf /.bootbackup."\$(date +%m.%d.%Y)".tar boot'
-EOF
-cat > /etc/modprobe.d/v4l2loopback.conf <<EOF
+if [ "$V4L2LOOPBACK" = yes ] ; then
+sudo sh -c 'cat > /etc/modprobe.d/v4l2loopback.conf <<EOF
options v4l2loopback video_nr=10,11,12 card_label="OBS Virtual Camera,Extra Loopback 1,Extra Loopback 2"
-EOF
+EOF'
-cat > /etc/modules-load.d/v4l2loopback.conf <<EOF
+sudo sh -c 'cat > /etc/modules-load.d/v4l2loopback.conf <<EOF
v4l2loopback
+EOF'
+fi
+
+if [ "$OKSH" = yes ] ; then
+ if ! [ -d "$okshdir" ] ; then
+ git clone https://github.com/ibara/oksh "$okshdir"
+ fi
+ cd "$okshdir"
+ git checkout oksh-7.6
+ ./configure
+ make
+ sudo make install
+ cd -
+
+ if ! grep /usr/local/bin/oksh /etc/shells ; then
+ sudo sh -c 'echo /usr/local/bin/oksh >> /etc/shells'
+ fi
+
+ if ! grep -qF 'export ENV=$HOME/.kshrc' ~/.profile; then
+ echo 'export ENV=$HOME/.kshrc' >> ~/.profile
+ fi
+
+ set +x
+ if ! grep "^$(id -un)" /etc/passwd | grep /usr/local/bin/oksh ; then
+ printf "Change shell to oksh? [y]es/[n]o: "
+ read -r resp
+ if [ "$resp" = "y" ] ; then
+ chsh -s /usr/local/bin/oksh
+ fi
+ fi
+ set -x
+
+
+fi
+
+if [ "$FONTS" = yes ] ; then
+ if ! [ -d ~/.fonts ]; then
+ git clone https://git.riedstra.dev/mitch/fonts ~/.fonts
+ fi
+fi
+
+if [ "$RIVER" = yes ] ; then
+ if ! [ -d "$rivercfgdir" ] ; then
+ git clone https://git.riedstra.dev/wl/rivercfg "$rivercfgdir"
+ fi
+ cd "$rivercfgdir"
+ sudo pacman -S river foot swaylock waybar wlr-randr bemenu bemenu-wayland swaybg grim slurp
+ ./link.sh
+ cd -
+
+ wlcustomdir="$rivercfgdir"/../wlcustom
+ if ! [ -d "$wlcustomdir" ] ; then
+ git clone https://git.riedstra.dev/wl/wlcustom "$wlcustomdir"
+ fi
+ cd "$wlcustomdir"
+ sudo make install
+ cd -
+fi
+
+if [ "$DPW" = yes ] ; then
+ if ! [ -d "$dpwdir" ] ; then
+ git clone https://git.riedstra.dev/mitch/dpw "$dpwdir"
+ fi
+ cd "$dpwdir"
+ make PREFIX="$HOME" install
+ cd -
+fi
+
+if [ "$YAY" = yes ] ; then
+ if ! [ -d "$yaydir" ] ; then
+ git clone https://aur.archlinux.org/yay.git "$yaydir"
+ fi
+ cd "$yaydir"
+ yay --version || makepkg -si
+ cd -
+fi
+
+if [ "$BRAVE" = yes ] ;then
+if [ "$YAY" == yes ] ; then
+ yay -Sy brave-bin
+else
+ echo "You need to install yay ( env YAY=yes ./distro/arch.sh or so )"
+ echo "In order to install brave via this script"
+fi
+fi
+
+
+if [ "$DWM" = yes ] ; then
+ sudo pacman -S picom
+
+ if ! [ -d "$dwmdir" ] ; then
+ git clone https://git.riedstra.dev/x/dwm "$dwmdir"
+ fi
+ cd "$dwmdir"
+ make
+ sudo make clean install
+ cd -
+
+ if ! [ -d "$dwmStdir" ] ; then
+ git clone https://git.riedstra.dev/x/st "$dwmStdir"
+ fi
+ cd "$dwmStdir"
+ make
+ sudo make clean install
+ cd -
+
+ if ! [ -d "$dwmDmenudir" ] ; then
+ git clone https://git.riedstra.dev/x/dmenu "$dwmDmenudir"
+ fi
+ cd "$dwmDmenudir"
+ make
+ sudo make clean install
+ cd -
+
+ if ! [ -d "$dwmSesdir" ] ; then
+ git clone https://git.riedstra.dev/x/session "$dwmSesdir"
+ fi
+ cd "$dwmSesdir"
+ sudo make install
+ cd -
+
+ if ! [ -f ~/.xinitrc ] ; then
+cat > ~/.xinitrc <<EOF
+export ENV=\$HOME/.kshrc
+export SSH_ASKPASS=dmenu_askpass
+xsetroot -grey &
+xset r rate 300 50 &
+dwm
EOF
+ chmod +x ~/.xinitrc
+ fi
+
+fi
+
+
+if [ "$GRAPHICS" = yes ] ; then
+case $(lspci | grep VGA) in
+ *Intel*)
+ # OpenCL Drivers
+ pacman -S --needed intel-compute-runtime
+ ;;
+ *AMD*)
+ # OpenCL Drivers
+ echo "Note ROCM isn't supported by all AMD GPUs"
+ pacman -S --needed rocm-opencl-runtime
+ ;;
+ *Nvidia*)
+ echo "Note older GPUs need 'nvidia' and/or 'nvidia-lts' instead of nvidia-open"
+ pacman -S --needed nvidia-open nvidia-open-lts nvidia-utils opencl-nvidia
+ ;;
+ *)
+ echo "No GPU detected"
+esac
+fi
+
+echo "You may wish to run systemctl enable sddm if you haven't already"