Port a few more options to zenity and separate dwm from the install script
This commit is contained in:
231
install.sh
231
install.sh
@@ -1,93 +1,132 @@
|
||||
#! /bin/bash
|
||||
|
||||
if ! command -v zenity; then
|
||||
sudo apt-get install zenity dialog -y
|
||||
sudo apt-get install zenity -y
|
||||
fi
|
||||
|
||||
BACKTITLE="Trude's Linux Toolkit"
|
||||
# Update System
|
||||
(
|
||||
sudo apt-get update
|
||||
echo "20"
|
||||
echo "# Updating distro packages..."
|
||||
sudo apt-get dist-upgrade -y
|
||||
echo "40"
|
||||
echo "# Updating installed packages..."
|
||||
sudo apt-get upgrade -y
|
||||
echo "60"
|
||||
echo "# Cleaning cache..."
|
||||
sudo apt-get clean
|
||||
echo "80"
|
||||
echo "# Removing unused dependencies..."
|
||||
sudo apt-get autoremove -y
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Update System" --text="Updating repositories..." --percentage=0 --no-cancel
|
||||
|
||||
# Dotfiles
|
||||
zenity --question \
|
||||
--title="Dotfiles" \
|
||||
--text="Apply Trude's configuration files?"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
(
|
||||
sudo apt-get install -y htop fzf git wget curl bash-completion
|
||||
echo "20"
|
||||
echo "# Copying dotfiles..."
|
||||
cp -vrf config-files/.* $HOME
|
||||
echo "40"
|
||||
cp -vrf config-files/* $HOME
|
||||
echo "50"
|
||||
echo "# Configure GNOME/GTK..."
|
||||
dconf load -f / < ./settings.dconf
|
||||
echo "60"
|
||||
echo "# Reloading font cache..."
|
||||
fc-cache -f
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Configuration" --text="Installing common utilities..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
# Flatpak
|
||||
zenity --question \
|
||||
--title="Install Apps" \
|
||||
--text="Enable Flatpak support?"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
(
|
||||
sudo apt install -y flatpak
|
||||
echo "30"
|
||||
echo "# Install the gnome-software plugin..."
|
||||
sudo apt install -y gnome-software-plugin-flatpak
|
||||
echo "50"
|
||||
echo "# Add Flathub..."
|
||||
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
echo "75"
|
||||
echo "# Installing Adw GTK3 theme for flatpak apps..."
|
||||
flatpak install org.gtk.Gtk3theme.adw-gtk3 org.gtk.Gtk3theme.adw-gtk3-dark
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Enabling Flatpak" --text="Installing Flatpak..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
# Apps
|
||||
options=(
|
||||
TRUE "Update OS"
|
||||
TRUE "Copy Dotfiles"
|
||||
FALSE "Install DWM Desktop"
|
||||
TRUE "Configure GNOME"
|
||||
TRUE "Install GitHub CLI"
|
||||
FALSE "Install Neovim"
|
||||
FALSE "Install Zed"
|
||||
FALSE "Install Ollama"
|
||||
TRUE "Install Apps (Enables Flatpak)"
|
||||
FALSE "Install GitHub CLI"
|
||||
FALSE "Install Tailscale (VPN)"
|
||||
FALSE "Install Syncthing"
|
||||
)
|
||||
# Use zenity --list to display menu and capture chosen option
|
||||
checkbox=$(zenity --list --checklist \
|
||||
--title="$BACKTITLE" \
|
||||
--title="Install Apps" \
|
||||
--column="Select" \
|
||||
--column="Tasks" "${options[@]}")
|
||||
|
||||
readarray -td '|' choices < <(printf '%s' "$checkbox")
|
||||
|
||||
compile() {
|
||||
cd programs/$1
|
||||
sudo make clean install
|
||||
cd ../..
|
||||
}
|
||||
|
||||
for selection in "${choices[@]}"; do
|
||||
if [ "$selection" = "Update OS" ]; then
|
||||
dialogUpdate() {
|
||||
dialog --backtitle "$BACKTITLE" --title "Update Debian and Packages" \
|
||||
--mixedgauge "Updating..." \
|
||||
0 0 $1 \
|
||||
"Update repos" "$2" \
|
||||
"Update distro" "$3" \
|
||||
"Update packages" "$4" \
|
||||
"Clean up " "$5"
|
||||
}
|
||||
|
||||
dialogUpdate 0 7 4 4 4
|
||||
|
||||
sudo apt-get update &> /dev/null
|
||||
dialogUpdate 15 5 7 4 4
|
||||
|
||||
sudo apt-get dist-upgrade -y &> /dev/null
|
||||
dialogUpdate 35 5 5 7 4DWM
|
||||
|
||||
sudo apt-get upgrade -y &> /dev/null
|
||||
dialogUpdate 80 5 5 5 7
|
||||
|
||||
sudo apt-get clean &> /dev/null
|
||||
sudo apt-get autoremove -y &> /dev/null
|
||||
dialogUpdate 100 5 5 5 5
|
||||
if [ "$selection" = "Install Neovim" ]; then
|
||||
(
|
||||
sudo apt install -y ninja-build gettext cmake unzip curl build-essential
|
||||
echo "30"
|
||||
git clone https://github.com/neovim/neovim --depth 1
|
||||
echo "50"
|
||||
cd neovim
|
||||
git checkout stable
|
||||
echo "60"
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
echo "80"
|
||||
sudo make install
|
||||
cd ..
|
||||
rm -rf neovim
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Neovim" --text="Installing Neovim..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Copy Dotfiles" ]; then
|
||||
# Neovim
|
||||
dialog --erase-on-exit \
|
||||
--backtitle "$BACKTITLE" \
|
||||
--title "Install/Update Neovim?" \
|
||||
--yesno "Nvim will be compiled from source. This may take a long time, depending on your device." 10 40
|
||||
|
||||
if [ "$?" -eq 0 ]; then
|
||||
# NVIM has to be compiled from source to support arm64 and i386 devices, for example.
|
||||
sudo apt install -y ninja-build gettext cmake unzip curl build-essential
|
||||
git clone https://github.com/neovim/neovim --depth 1
|
||||
cd neovim
|
||||
git checkout stable
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
sudo make install
|
||||
cd ..
|
||||
rm -rf neovim
|
||||
if [ "$selection" = "Install Zed" ]; then
|
||||
zenity --notification --window-icon="info" --text="Installing Zed..."
|
||||
curl https://zed.dev/install.sh | sh
|
||||
if [[ $? == 0 ]]; then
|
||||
zenity --notification --window-icon="info" --text="Zed is now installed."
|
||||
else
|
||||
zenity --notification --window-icon="error" --text="Zed failed to install."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Zed
|
||||
#dialog --erase-on-exit \
|
||||
# --backtitle "$BACKTITLE" \
|
||||
# --title "Install Zed?" \
|
||||
# --yesno "Zed (code editor) will be installed using the official install script." 10 40
|
||||
if [ "$selection" = "Install Ollama" ]; then
|
||||
zenity --notification --window-icon="info" --text="Installing Ollama..."
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
if [[ $? == 0 ]]; then
|
||||
zenity --notification --window-icon="info" --text="Ollama is now installed."
|
||||
else
|
||||
zenity --notification --window-icon="error" --text="Ollama failed to install."
|
||||
fi
|
||||
fi
|
||||
|
||||
#if [ "$?" -eq 0 ]; then
|
||||
# curl https://zed.dev/install.sh | sh
|
||||
#fi
|
||||
# ------ TODO ---------
|
||||
|
||||
if [ "$selection" = "########" ]; then
|
||||
# Firefox Theme
|
||||
dialog --erase-on-exit \
|
||||
--backtitle "$BACKTITLE" \
|
||||
@@ -97,46 +136,6 @@ for selection in "${choices[@]}"; do
|
||||
if [ "$?" -eq 0 ]; then
|
||||
curl -s -o- https://raw.githubusercontent.com/rafaelmardojai/firefox-gnome-theme/master/scripts/install-by-curl.sh | bash
|
||||
fi
|
||||
|
||||
echo "Installing utilities..."
|
||||
sudo apt install -y htop fzf git wget curl bash-completion
|
||||
|
||||
echo "Copying dotfiles..."
|
||||
cp -vrf dotfiles/.* $HOME
|
||||
cp -vrf dotfiles/* $HOME
|
||||
|
||||
echo "Loading fonts..."
|
||||
fc-cache -f
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install DWM Desktop" ]; then
|
||||
clear
|
||||
echo "---------------------------"
|
||||
echo "--- Install DWM Desktop ---"
|
||||
echo "---------------------------"
|
||||
echo
|
||||
echo
|
||||
|
||||
# Install Dependencies
|
||||
sudo apt install -y xorg picom libx11-dev libxft-dev libxinerama-dev build-essential libxrandr-dev policykit-1-gnome dbus-x11 pipewire-audio wireplumber pipewire-pulse pipewire-alsa network-manager firefox-esr feh scrot dunst
|
||||
systemctl --user --now enable wireplumber.service
|
||||
sudo systemctl enable NetworkManager
|
||||
|
||||
# Compile
|
||||
for program in "dwm" "dmenu" "slock" "st" "tabbed" "dwmblocks"; do
|
||||
compile $program
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Configure GNOME" ]; then
|
||||
clear
|
||||
echo "-----------------------"
|
||||
echo "--- Configure GNOME ---"
|
||||
echo "-----------------------"
|
||||
echo
|
||||
echo
|
||||
|
||||
dconf load -f / < ./settings.dconf
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install GitHub CLI" ]; then
|
||||
@@ -157,18 +156,6 @@ for selection in "${choices[@]}"; do
|
||||
sudo apt install gh -y
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install Ollama" ]; then
|
||||
clear
|
||||
echo "----------------------"
|
||||
echo "--- Install Ollama ---"
|
||||
echo "----------------------"
|
||||
echo
|
||||
echo
|
||||
|
||||
# Ollama - LLM Server
|
||||
curl -fsSL https://ollama.com/install.sh | sh
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install Apps (Enables Flatpak)" ]; then
|
||||
clear
|
||||
echo "----------------------------"
|
||||
@@ -177,13 +164,7 @@ for selection in "${choices[@]}"; do
|
||||
echo
|
||||
echo
|
||||
|
||||
echo "Enabling Flatpak..."
|
||||
sudo apt install -y flatpak
|
||||
sudo apt install -y gnome-software-plugin-flatpak
|
||||
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
echo "Installing Flatpak GTK3 theme..."
|
||||
flatpak install org.gtk.Gtk3theme.adw-gtk3 org.gtk.Gtk3theme.adw-gtk3-dark
|
||||
|
||||
dialog --erase-on-exit \
|
||||
--backtitle "$BACKTITLE" \
|
||||
|
||||
Reference in New Issue
Block a user