improve bash script (#156)

This commit is contained in:
end-4
2023-12-29 23:00:17 +07:00
parent 97dd57c80c
commit 70f331c89d
+30 -31
View File
@@ -1,48 +1,47 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
echo 'Hi there!' printf 'Hi there!\n'
echo 'This script 1. only works for ArchLinux and Arch-based distros.' printf 'This script 1. only works for ArchLinux and Arch-based distros.\n'
echo ' 2. has not been tested, use at your own risk.' printf ' 2. has not been tested, use at your own risk.\n'
echo ' 3. will show all commands that it runs.' printf ' 3. will show all commands that it runs.\n'
echo ' 4. should be run from its folder.' printf "\e[36m== BACKUP YOUR CONFIG FOLDER IF NEEDED! ==\n"
echo '== BACKUP YOUR CONFIG FOLDER IF NEEDED! ==' printf 'Ctrl+C to exit. Enter to continue.\n'
echo 'Ctrl+C to exit. Enter to continue.' read -r
read
##################################################################################### #####################################################################################
echo '1. Get packages and add user to video/input groups' printf '\e[36m1. Get packages and add user to video/input groups\n\e[97m'
echo 'yay -S blueberry brightnessctl coreutils curl fish foot fuzzel gjs gnome-bluetooth-3.0 gnome-control-center gnome-keyring gobject-introspection grim gtk3 gtk-layer-shell libdbusmenu-gtk3 meson networkmanager npm plasma-browser-integration playerctl polkit-gnome python-pywal ripgrep sassc slurp starship swayidle swaylock typescript upower xorg-xrandr webp-pixbuf-loader wget wireplumber wl-clipboard tesseract yad ydotool adw-gtk3-git cava gojq gradience-git gtklock gtklock-playerctl-module gtklock-powerbar-module gtklock-userinfo-module hyprland-git lexend-fonts-git python-material-color-utilities python-pywal python-poetry python-build python-pillow swaylock-effects-git swww ttf-material-symbols-variable-git ttf-space-mono-nerd ttf-jetbrains-mono-nerd wayland-idle-inhibitor-git wlogout wlsunset-git' set -v
yay -S blueberry brightnessctl coreutils curl fish foot fuzzel gjs gnome-bluetooth-3.0 gnome-control-center gnome-keyring gobject-introspection grim gtk3 gtk-layer-shell libdbusmenu-gtk3 meson networkmanager npm plasma-browser-integration playerctl polkit-gnome python-pywal ripgrep sassc slurp starship swayidle swaylock typescript upower xorg-xrandr webp-pixbuf-loader wget wireplumber wl-clipboard tesseract yad ydotool adw-gtk3-git cava gojq gradience-git gtklock gtklock-playerctl-module gtklock-powerbar-module gtklock-userinfo-module hyprland-git lexend-fonts-git python-material-color-utilities python-pywal python-poetry python-build python-pillow swaylock-effects-git swww ttf-material-symbols-variable-git ttf-space-mono-nerd ttf-jetbrains-mono-nerd wayland-idle-inhibitor-git wlogout wlsunset-git yay -S --needed --noconfirm blueberry brightnessctl coreutils curl fish foot fuzzel gjs gnome-bluetooth-3.0 gnome-control-center gnome-keyring gobject-introspection grim gtk3 gtk-layer-shell libdbusmenu-gtk3 meson networkmanager npm plasma-browser-integration playerctl polkit-gnome python-pywal ripgrep sassc slurp starship swayidle swaylock typescript upower xorg-xrandr webp-pixbuf-loader wget wireplumber wl-clipboard tesseract yad ydotool adw-gtk3-git cava gojq gradience-git gtklock gtklock-playerctl-module gtklock-powerbar-module gtklock-userinfo-module hyprland-git lexend-fonts-git python-material-color-utilities python-pywal python-poetry python-build python-pillow swaylock-effects-git swww ttf-material-symbols-variable-git ttf-space-mono-nerd ttf-jetbrains-mono-nerd wayland-idle-inhibitor-git wlogout wlsunset-git
user=$(whoami) user=$(whoami)
echo "sudo usermod -aG video $user" sudo usermod -aG video "$user"
sudo usermod -aG video "$user" || echo "failed to add user to video group" sudo usermod -aG input "$user"
echo "sudo usermod -aG input $user"
sudo usermod -aG input "$user" || echo "failed to add user to input group"
echo "Step 1 Complete."
##################################################################################### #####################################################################################
echo '2. Installing AGS manually' set +v
printf '\e[36m2. Installing AGS manually\e[97m\n'
sleep 1 sleep 1
echo 'git clone --recursive https://github.com/Aylur/ags.git && cd ags' set -v
git clone --recursive https://github.com/Aylur/ags.git && cd ags || echo "failed to clone into ags. Aborting..." && exit git clone --recursive https://github.com/Aylur/ags.git
echo "Done Cloning! Setting up npm and meson..." set +v
sleep 1 sleep 1
echo 'npm install && meson setup build' set -v
npm install && meson setup build npm install && meson setup build
echo 'meson install -C build'
echo '(Make sure you say yes when asked to use sudo here)'
meson install -C build meson install -C build
##################################################################################### #####################################################################################
echo '3. Copying' set +v
printf '\e[36m3. Copying\e[97m\n'
echo 'cp -r "./.config" "$HOME"' set -v
cp -r "./.config" "$HOME" || echo "cp threw error. You could cp this yourself." cp -r "./.config" "$HOME"
echo 'cp -r "./.local" "$HOME"' cp -r "./.local" "$HOME"
cp -r "./.local" "$HOME" || echo "cp threw error. You could cp this yourself."
##################################################################################### #####################################################################################
echo 'Finished. See the "Import manually" folder and grab anything you need.' set +v
echo 'Press Ctrl+Super+T to select a wallpaper' printf 'Finished. See the "Import manually" folder and grab anything you need.\e[97m\n'
echo 'Press Super+/ for a list of keybinds' printf 'Press Ctrl+Super+T to select a wallpaper\e[97m\n'
printf 'Press Super+/ for a list of keybinds\e[97m\n'