deploy (1759B)
1 #!/bin/sh 2 3 # MUST BE RUN IN THE THIS DIRECTORY !! 4 5 set -e 6 7 USAGE="Usage: ./deploy [thinkpad|framework|desktop]" 8 9 if [ -z "$1" ]; then 10 echo $USAGE 11 exit 12 fi 13 14 if [ $(echo "$1" | cut -c1-1) = "t" ]; then 15 hardware="thinkpad" 16 FOOT_FONT="Iosevka Nerd Font:size=14" 17 SAKURA_FONT="Iosevka Nerd Font 12" 18 elif [ $(echo "$1" | cut -c1-1) = "d" ]; then 19 hardware="desktop" 20 FOOT_FONT="Iosevka Nerd Font:pixelsize=18" 21 SAKURA_FONT="Iosevka Nerd Font 12" 22 elif [ $(echo "$1" | cut -c1-1) = "f" ]; then 23 hardware="framework" 24 FOOT_FONT="Iosevka Nerd Font:pixelsize=14" 25 SAKURA_FONT="Iosevka Nerd Font 12" 26 else 27 echo $USAGE 28 exit 29 fi 30 31 symlink_file() { 32 input=$1 33 output=$2 34 35 rm -f $output 36 ln -s $input $output 37 } 38 39 symlink_file "$(pwd)/device-specific/$hardware/hardware" "$(pwd)/.config/sway/hardware-specific-config" 40 symlink_file "$(pwd)/device-specific/$hardware/i3status" "$(pwd)/.config/i3status/config" 41 symlink_file "$(pwd)/device-specific/$hardware/emacs.el" "$(pwd)/.config/emacs/local/device.el" 42 symlink_file "$(pwd)/device-specific/$hardware/dwl-hardware.h" "$(pwd)/dwl/device.h" 43 symlink_file "$(pwd)/device-specific/$hardware/river" "$(pwd)/.config/river/device" 44 symlink_file "$(pwd)/device-specific/$hardware/waybar" "$(pwd)/.config/waybar/config.jsonc" 45 symlink_file "$(pwd)/device-specific/$hardware/baraction" "$(pwd)/scripts/baraction" 46 47 mkdir -p "$(pwd)/.config/foot" 48 sed "s/{FOOT_FONT}/$FOOT_FONT/g" "$(pwd)/shared-configs/foot/template.ini" > "$(pwd)/.config/foot/foot.ini" 49 50 mkdir -p "$(pwd)/.config/sakura" 51 sed "s/{SAKURA_FONT}/$SAKURA_FONT/g" "$(pwd)/shared-configs/sakura/template.conf" > "$(pwd)/.config/sakura/sakura.conf" 52 53 stow -D . 2> /dev/null 54 stow . 55 56 echo "Successfully deployed "$hardware"'s configuration"