Format code
This commit is contained in:
195
install.sh
195
install.sh
@@ -2,18 +2,18 @@
|
||||
|
||||
# Sudo auth
|
||||
auth() {
|
||||
echo "$sudopass" | sudo -S -k $*
|
||||
echo "$sudopass" | sudo -S -k $*
|
||||
}
|
||||
export HISTIGNORE='*sudo -S*'
|
||||
for (( ; ; )); do
|
||||
sudopass=$(zenity --password)
|
||||
if [ -z "${sudopass}" ]; then
|
||||
exit
|
||||
fi
|
||||
auth echo "Test sudo password."
|
||||
if [[ $? == 0 ]]; then
|
||||
break
|
||||
fi
|
||||
sudopass=$(zenity --password)
|
||||
if [ -z "${sudopass}" ]; then
|
||||
exit
|
||||
fi
|
||||
auth echo "Test sudo password."
|
||||
if [[ $? == 0 ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if ! command -v zenity; then
|
||||
@@ -22,30 +22,30 @@ fi
|
||||
|
||||
# Update System
|
||||
(
|
||||
auth apt-get update
|
||||
echo "20"
|
||||
echo "# Updating distro packages..."
|
||||
auth apt-get dist-upgrade -y
|
||||
echo "40"
|
||||
echo "# Updating installed packages..."
|
||||
auth apt-get upgrade -y
|
||||
echo "60"
|
||||
echo "# Cleaning cache..."
|
||||
auth apt-get clean
|
||||
echo "80"
|
||||
echo "# Removing unused dependencies..."
|
||||
auth apt-get autoremove -y
|
||||
echo "100"
|
||||
auth apt-get update
|
||||
echo "20"
|
||||
echo "# Updating distro packages..."
|
||||
auth apt-get dist-upgrade -y
|
||||
echo "40"
|
||||
echo "# Updating installed packages..."
|
||||
auth apt-get upgrade -y
|
||||
echo "60"
|
||||
echo "# Cleaning cache..."
|
||||
auth apt-get clean
|
||||
echo "80"
|
||||
echo "# Removing unused dependencies..."
|
||||
auth apt-get autoremove -y
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Update System" --text="Updating repositories..." --percentage=0 --no-cancel
|
||||
zenity --progress --title="Update System" --text="Updating repositories..." --percentage=0 --no-cancel
|
||||
|
||||
# Dotfiles
|
||||
zenity --question \
|
||||
--title="Dotfiles" \
|
||||
--text="Apply Trude's configuration files?"
|
||||
--title="Dotfiles" \
|
||||
--text="Apply Trude's configuration files?"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
(
|
||||
(
|
||||
auth apt-get install -y htop fzf git wget curl bash-completion
|
||||
echo "20"
|
||||
echo "# Copying dotfiles..."
|
||||
@@ -54,22 +54,22 @@ if [[ $? == 0 ]]; then
|
||||
cp -vrf config-files/* $HOME
|
||||
echo "50"
|
||||
echo "# Configure GNOME/GTK..."
|
||||
dconf load -f / < ./settings.dconf
|
||||
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?"
|
||||
--title="Install Apps" \
|
||||
--text="Enable Flatpak support?"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
(
|
||||
(
|
||||
auth apt-get install -y flatpak
|
||||
echo "30"
|
||||
echo "# Install the gnome-software plugin..."
|
||||
@@ -81,7 +81,7 @@ if [[ $? == 0 ]]; then
|
||||
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
|
||||
|
||||
@@ -94,8 +94,7 @@ options=(
|
||||
FALSE "Install Tailscale"
|
||||
FALSE "Install Firefox + Adw theme"
|
||||
)
|
||||
checkbox=$(zenity --list --checklist --height=500\
|
||||
--title="Install Apps" \
|
||||
checkbox=$(zenity --list --checklist --height=500 --title="Install Apps" \
|
||||
--column="Select" \
|
||||
--column="Tasks" "${options[@]}")
|
||||
readarray -td '|' choices < <(printf '%s' "$checkbox")
|
||||
@@ -103,30 +102,30 @@ readarray -td '|' choices < <(printf '%s' "$checkbox")
|
||||
for selection in "${choices[@]}"; do
|
||||
if [ "$selection" = "Install Neovim" ]; then
|
||||
(
|
||||
auth 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"
|
||||
auth make install
|
||||
cd ..
|
||||
rm -rf neovim
|
||||
echo "100"
|
||||
auth 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"
|
||||
auth make install
|
||||
cd ..
|
||||
rm -rf neovim
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Neovim" --text="Installing Neovim..." --percentage=0 --no-cancel
|
||||
zenity --progress --title="Neovim" --text="Installing Neovim..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
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."
|
||||
zenity --notification --window-icon="info" --text="Zed is now installed."
|
||||
else
|
||||
zenity --notification --window-icon="error" --text="Zed failed to install."
|
||||
zenity --notification --window-icon="error" --text="Zed failed to install."
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -134,58 +133,58 @@ for selection in "${choices[@]}"; do
|
||||
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."
|
||||
zenity --notification --window-icon="info" --text="Ollama is now installed."
|
||||
else
|
||||
zenity --notification --window-icon="error" --text="Ollama failed to install."
|
||||
zenity --notification --window-icon="error" --text="Ollama failed to install."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install GitHub CLI" ]; then
|
||||
(
|
||||
auth apt-get install wget -y
|
||||
echo "20"
|
||||
auth mkdir -p -m 755 /etc/apt/keyrings
|
||||
auth rm -f /etc/apt/sources.list.d/github-cli.list
|
||||
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | auth tee /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "40"
|
||||
auth chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | auth tee /etc/apt/sources.list.d/github-cli.list
|
||||
auth apt-get update
|
||||
echo "60"
|
||||
auth apt-get install gh -y
|
||||
echo "100"
|
||||
auth apt-get install wget -y
|
||||
echo "20"
|
||||
auth mkdir -p -m 755 /etc/apt/keyrings
|
||||
auth rm -f /etc/apt/sources.list.d/github-cli.list
|
||||
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | auth tee /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "40"
|
||||
auth chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | auth tee /etc/apt/sources.list.d/github-cli.list
|
||||
auth apt-get update
|
||||
echo "60"
|
||||
auth apt-get install gh -y
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="GitHub CLI" --text="Installing GitHub CLI..." --percentage=0 --no-cancel
|
||||
zenity --progress --title="GitHub CLI" --text="Installing GitHub CLI..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install Tailscale" ]; then
|
||||
(
|
||||
curl -fsSL https://tailscale.com/install.sh | sh
|
||||
echo "80"
|
||||
auth tailscale up
|
||||
echo "100"
|
||||
curl -fsSL https://tailscale.com/install.sh | sh
|
||||
echo "80"
|
||||
auth tailscale up
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Tailscale" --text="Installing Tailscale..." --percentage=0 --no-cancel
|
||||
zenity --progress --title="Tailscale" --text="Installing Tailscale..." --percentage=0 --no-cancel
|
||||
fi
|
||||
|
||||
if [ "$selection" = "Install Firefox + Adw theme" ]; then
|
||||
(
|
||||
auth apt install -y firefox-esr
|
||||
echo "60"
|
||||
firefox &
|
||||
sleep 5
|
||||
echo "80"
|
||||
echo "# Applying Adw theme..."
|
||||
curl -s -o- https://raw.githubusercontent.com/rafaelmardojai/firefox-gnome-theme/master/scripts/install-by-curl.sh | bash
|
||||
echo "100"
|
||||
auth apt install -y firefox-esr
|
||||
echo "60"
|
||||
firefox &
|
||||
sleep 5
|
||||
echo "80"
|
||||
echo "# Applying Adw theme..."
|
||||
curl -s -o- https://raw.githubusercontent.com/rafaelmardojai/firefox-gnome-theme/master/scripts/install-by-curl.sh | bash
|
||||
echo "100"
|
||||
) |
|
||||
zenity --progress --title="Firefox" --text="Installing Firefox..." --percentage=0 --no-cancel
|
||||
zenity --progress --title="Firefox" --text="Installing Firefox..." --percentage=0 --no-cancel
|
||||
fi
|
||||
done
|
||||
|
||||
# Flatpak Apps
|
||||
if command -v flatpak; then
|
||||
options=(
|
||||
options=(
|
||||
FALSE "io.github.mrvladus.List" "Errands (Tasks)"
|
||||
FALSE "io.gitlab.news_flash.NewsFlash" "Newsflash (RSS)"
|
||||
FALSE "org.gnome.gitlab.somas.Apostrophe" "Apostrophe (Markdown Editor)"
|
||||
@@ -203,26 +202,26 @@ if command -v flatpak; then
|
||||
FALSE "re.sonny.Workbench" "Workbench"
|
||||
FALSE "org.prismlauncher.PrismLauncher" "Prism Launcher"
|
||||
FALSE "md.obsidian.Obsidian" "Obsidian"
|
||||
)
|
||||
checkbox=$(zenity --list --checklist --width=800 --height=600 \
|
||||
)
|
||||
checkbox=$(zenity --list --checklist --width=800 --height=600 \
|
||||
--title="Install Apps" \
|
||||
--column="Select" \
|
||||
--column="App ID"\
|
||||
--column="App ID" \
|
||||
--column="App Name" "${options[@]}")
|
||||
readarray -td '|' choices < <(printf '%s' "$checkbox")
|
||||
readarray -td '|' choices < <(printf '%s' "$checkbox")
|
||||
|
||||
declare -i app_counter=0
|
||||
declare -i app_total="${#choices[@]}"
|
||||
declare -i app_counter=0
|
||||
declare -i app_total="${#choices[@]}"
|
||||
|
||||
for app in "${choices[@]}"; do
|
||||
app_counter+=1
|
||||
echo "Installing $app ($app_counter/$app_total)..."
|
||||
zenity --notification --icon="info" --text="Installing $app ($app_counter/$app_total)..."
|
||||
flatpak install -y flathub $app
|
||||
if [[ $? == 0 ]]; then
|
||||
zenity --notification --icon="info" --text="$app is now installed."
|
||||
else
|
||||
zenity --notification --icon="error" --text="$app failed to install."
|
||||
fi
|
||||
done
|
||||
for app in "${choices[@]}"; do
|
||||
app_counter+=1
|
||||
echo "Installing $app ($app_counter/$app_total)..."
|
||||
zenity --notification --icon="info" --text="Installing $app ($app_counter/$app_total)..."
|
||||
flatpak install -y flathub $app
|
||||
if [[ $? == 0 ]]; then
|
||||
zenity --notification --icon="info" --text="$app is now installed."
|
||||
else
|
||||
zenity --notification --icon="error" --text="$app failed to install."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user