304 lines
11 KiB
Bash
304 lines
11 KiB
Bash
|
#!/bin/bash
|
||
|
#
|
||
|
# Script Name: install_ubuntu24.04.sh
|
||
|
# Version : 1.0
|
||
|
# Description: Installation script auto customization
|
||
|
# GNOME 46 Look Like macOS on Ubuntu 24.04
|
||
|
#
|
||
|
# For Linux : Ubuntu 24.04
|
||
|
# For Desktop Environment : GNOME Shell 46
|
||
|
# Author: linuxscoop
|
||
|
# Youtube: https://youtube.com/user/linuxscoop
|
||
|
# Created: May 20, 2024
|
||
|
# Last Modified: June 07, 2024
|
||
|
#
|
||
|
# update the system
|
||
|
update_system() {
|
||
|
clear
|
||
|
echo "Update your system with new packages.."
|
||
|
sudo apt update && sudo apt dist-upgrade -y
|
||
|
}
|
||
|
|
||
|
# remove snap apps and daemon, and prevent their reinstallation
|
||
|
remove_snap_and_prevent_reinstall() {
|
||
|
echo "Removing snap apps and snap daemon.."
|
||
|
# backup snap folder on $HOME
|
||
|
cp -af $HOME/snap/ src/
|
||
|
# Commands to remove snap apps and daemon
|
||
|
sudo snap remove --purge firefox
|
||
|
sudo snap remove --purge snap-store
|
||
|
sudo snap remove --purge gnome-42-2204
|
||
|
sudo snap remove --purge gtk-common-themes
|
||
|
sudo snap remove --purge snapd-desktop-integration
|
||
|
sudo snap remove --purge firmware-updater
|
||
|
sudo snap remove --purge core22
|
||
|
sudo snap remove --purge bare
|
||
|
sudo snap remove --purge snapd
|
||
|
sudo apt autoremove --remove snapd -y
|
||
|
sudo rm -rf /var/cache/snapd/
|
||
|
# Prevent snapd from being installed
|
||
|
echo "Package: snapd
|
||
|
Pin: release a=*
|
||
|
Pin-Priority: -10" | sudo tee /etc/apt/preferences.d/nosnap.pref
|
||
|
sudo apt update
|
||
|
}
|
||
|
|
||
|
install_firefox_from_mozilla_ppa() {
|
||
|
# Define the distro codename
|
||
|
distro_codename=$(lsb_release -cs)
|
||
|
# Add the Mozilla team PPA and update package lists
|
||
|
sudo add-apt-repository -y ppa:mozillateam/ppa
|
||
|
sudo apt update
|
||
|
# Install Firefox from the Mozilla team PPA
|
||
|
sudo apt install -y -t 'o=LP-PPA-mozillateam' firefox
|
||
|
# Allow unattended upgrades from the Mozilla team PPA
|
||
|
echo "Unattended-Upgrade::Allowed-Origins:: \"LP-PPA-mozillateam:$distro_codename\";" | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
|
||
|
# Set the pinning preferences for Firefox packages from the Mozilla team PPA
|
||
|
echo 'Package: firefox*
|
||
|
Pin: release o=LP-PPA-mozillateam
|
||
|
Pin-Priority: 501' | sudo tee /etc/apt/preferences.d/mozillateamppa
|
||
|
# Update package lists again to apply pinning preferences
|
||
|
sudo apt update
|
||
|
# Restore firefox data from firefox snap
|
||
|
mkdir -p $HOME/.mozilla/firefox/ && cp -af src/snap/firefox/common/.mozilla/firefox/* ~/.mozilla/firefox/
|
||
|
}
|
||
|
|
||
|
# install apps and dependencies
|
||
|
install_apps_and_dependencies() {
|
||
|
clear
|
||
|
echo "Install Command Line Apps and dependencies.."
|
||
|
sudo apt install curl \
|
||
|
rsync \
|
||
|
git \
|
||
|
gdebi \
|
||
|
nautilus-admin \
|
||
|
nautilus-extension-gnome-terminal \
|
||
|
sassc \
|
||
|
gnome-tweaks \
|
||
|
gnome-shell-extension-manager -y
|
||
|
}
|
||
|
|
||
|
# install apps and dependencies
|
||
|
install_gnome_apps() {
|
||
|
clear
|
||
|
echo "Install GNOME Apps and Dependencies.."
|
||
|
sudo apt install gnome-weather \
|
||
|
gnome-maps \
|
||
|
gnome-audio \
|
||
|
gnome-calendar \
|
||
|
gnome-clocks \
|
||
|
gnome-connections \
|
||
|
gnome-console \
|
||
|
gnome-contacts \
|
||
|
gnome-music \
|
||
|
vlc \
|
||
|
gnome-shell-pomodoro -y
|
||
|
}
|
||
|
|
||
|
# Install WhiteSur GTK theme and configure it
|
||
|
install_whitesur_gtk_theme() {
|
||
|
clear
|
||
|
echo "Installing WhiteSur GTK theme..."
|
||
|
# Create src directory if it doesn't exist
|
||
|
mkdir -p src && cd src/ || { echo "Failed to create or enter src directory"; exit 1; }
|
||
|
# Clone the repository if it doesn't already exist
|
||
|
if [ ! -d "WhiteSur-gtk-theme" ]; then
|
||
|
git clone https://github.com/vinceliuice/WhiteSur-gtk-theme.git || { echo "Failed to clone WhiteSur-gtk-theme repository"; exit 1; }
|
||
|
fi
|
||
|
cd WhiteSur-gtk-theme/ || { echo "Failed to enter WhiteSur-gtk-theme directory"; exit 1; }
|
||
|
# Install the theme
|
||
|
./install.sh -l -c Light -c Dark -s 180 -m || { echo "Failed to execute install.sh"; exit 1; }
|
||
|
# Apply tweaks
|
||
|
./tweaks.sh -d || { echo "Failed to execute tweaks.sh"; exit 1; }
|
||
|
cd ../../ || { echo "Failed to return to the previous directory"; exit 1; }
|
||
|
# Enable WhiteSur GTK theme support for libadwaita apps - Light mode
|
||
|
ln -sf "$HOME/.config/gtk-4.0/gtk-Light.css" "$HOME/.config/gtk-4.0/gtk.css"
|
||
|
echo "WhiteSur GTK theme installation completed."
|
||
|
}
|
||
|
|
||
|
# Install WhiteSur icon theme
|
||
|
install_whitesur_icon_theme() {
|
||
|
clear
|
||
|
echo "Installing WhiteSur icon theme..."
|
||
|
cd src/ || { echo "Failed to enter src directory"; exit 1; }
|
||
|
# Clone the repository if it doesn't already exist
|
||
|
if [ ! -d "WhiteSur-icon-theme" ]; then
|
||
|
git clone https://github.com/vinceliuice/WhiteSur-icon-theme.git || { echo "Failed to clone WhiteSur-icon-theme repository"; exit 1; }
|
||
|
fi
|
||
|
cd WhiteSur-icon-theme/ || { echo "Failed to enter WhiteSur-icon-theme directory"; exit 1; }
|
||
|
# Install the icon theme
|
||
|
./install.sh -a -b || { echo "Failed to execute install.sh"; exit 1; }
|
||
|
cd ../../ || { echo "Failed to return to the previous directory"; exit 1; }
|
||
|
echo "WhiteSur icon theme installation completed."
|
||
|
}
|
||
|
|
||
|
# install WhiteSur Firefox Theme
|
||
|
install_whitesur_firefox_theme() {
|
||
|
clear
|
||
|
echo "Installing WhiteSur Firefox Theme..."
|
||
|
# Create src directory if it doesn't exist
|
||
|
mkdir -p src && cd src/ || { echo "Failed to create or enter src directory"; exit 1; }
|
||
|
# Clone the repository if it doesn't already exist
|
||
|
if [ ! -d "WhiteSur-firefox-theme" ]; then
|
||
|
git clone https://github.com/vinceliuice/WhiteSur-firefox-theme.git || { echo "Failed to clone WhiteSur-firefox-theme repository"; exit 1; }
|
||
|
fi
|
||
|
cd WhiteSur-firefox-theme/ || { echo "Failed to enter WhiteSur-firefox-theme directory"; exit 1; }
|
||
|
# Install the theme
|
||
|
./install.sh -m || { echo "Failed to execute install.sh"; exit 1; }
|
||
|
cd ../../ || { echo "Failed to return to the previous directory"; exit 1; }
|
||
|
echo "WhiteSur Firefox theme installation completed."
|
||
|
}
|
||
|
|
||
|
# install Cursors theme
|
||
|
install_cursors_theme() {
|
||
|
clear
|
||
|
echo "Install Cursors theme.."
|
||
|
if [ -d $HOME/.icons ]; then
|
||
|
cp -af res/WhiteSur-cursors/ $HOME/.icons/
|
||
|
else
|
||
|
mkdir $HOME/.icons
|
||
|
cp -af res/WhiteSur-cursors/ $HOME/.icons/
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# Install fonts and wallpapers
|
||
|
install_fonts_and_wallpapers() {
|
||
|
clear
|
||
|
echo "Install Fonts and wallpapers.."
|
||
|
cp -af res/fonts/ $HOME/.local/share/
|
||
|
# Install Wallpaper to /usr/share/backgrounds/
|
||
|
sudo cp -af res/macosw/ /usr/share/backgrounds/
|
||
|
sudo chmod 755 /usr/share/backgrounds/macosw
|
||
|
sudo chmod 644 /usr/share/backgrounds/macosw/*.*
|
||
|
}
|
||
|
|
||
|
# install GNOME Shell Extensions
|
||
|
install_gnome_shell_extensions() {
|
||
|
clear
|
||
|
echo "Install GNOME Shell Extensions.."
|
||
|
if [ -d $HOME/.local/share/gnome-shell/extensions ]; then
|
||
|
cp -af res/extensions/* $HOME/.local/share/gnome-shell/extensions/
|
||
|
else
|
||
|
mkdir -p $HOME/.local/share/gnome-shell/extensions
|
||
|
cp -af res/extensions/* $HOME/.local/share/gnome-shell/extensions/
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# install Cava, Neofetch and their configurations
|
||
|
install_cava_neofetch() {
|
||
|
clear
|
||
|
echo "Install Cava, Neofetch and Configuration.."
|
||
|
sudo apt install cava -y
|
||
|
# Install Cava Config
|
||
|
cp -af conf/cava/ $HOME/.config/
|
||
|
# Install Neofetch
|
||
|
sudo apt install neofetch -y
|
||
|
# Install Neofetch Config
|
||
|
cp -af conf/neofetch/ $HOME/.config/
|
||
|
}
|
||
|
|
||
|
# Function to install Oh My Zsh
|
||
|
install_zsh_oh_my_zsh() {
|
||
|
clear
|
||
|
echo "Install Oh My Zsh.."
|
||
|
sudo apt install zsh -y
|
||
|
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" <<EOF
|
||
|
Y
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
# install Powerlevel10k theme
|
||
|
install_powerlevel10k_theme() {
|
||
|
clear
|
||
|
echo "Install Powerlevel10k theme.."
|
||
|
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
||
|
# Add or update the ZSH_THEME line in ~/.zshrc
|
||
|
sed -i 's/ZSH_THEME="robbyrussell"/# ZSH_THEME="robbyrussell"\nZSH_THEME="powerlevel10k\/powerlevel10k"/' $HOME/.zshrc
|
||
|
# Change the shell to Zsh
|
||
|
sudo chsh -s "$(which zsh)" "$(whoami)"
|
||
|
# Sync zsh shell configuration files to the home directory
|
||
|
find conf/ \( -name .p10k.zsh -o -name .zshrc \) -exec rsync -av {} $HOME/ \;
|
||
|
}
|
||
|
|
||
|
# enable Flatpak, Appimage Support and add Flathub Repository
|
||
|
enable_flatpak_and_appimage_support() {
|
||
|
clear
|
||
|
echo "Enable Flatpak, Appimage Support and Add Flathub Repository.."
|
||
|
sudo apt install gnome-software gnome-software-plugin-flatpak flatpak libfuse2 -y
|
||
|
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||
|
}
|
||
|
|
||
|
# install Flatpak applications
|
||
|
install_flatpak_apps() {
|
||
|
clear
|
||
|
echo "Install Flatpak Applications.."
|
||
|
flatpak install flathub io.bassi.Amberol # net.agalwood.Motrix com.rafaelmardojai.Blanket com.github.KRTirtho.Spotube
|
||
|
# Enable WhiteSur GTK theme support for flatpak
|
||
|
sudo flatpak override --filesystem=$HOME/.themes
|
||
|
sudo flatpak override --filesystem=$HOME/.local/share/icons
|
||
|
sudo flatpak override --filesystem=xdg-config/gtk-4.0
|
||
|
}
|
||
|
|
||
|
# install Plymouth macOS theme
|
||
|
install_plymouth_macos_theme() {
|
||
|
clear
|
||
|
echo "Install Plymouth macOS Theme.."
|
||
|
sudo apt install plymouth -y
|
||
|
# Copy Plymouth theme to /usr/share/plymouth/themes
|
||
|
sudo cp -af res/macOS/ /usr/share/plymouth/themes/
|
||
|
# Set Plymouth theme
|
||
|
sudo update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/macOS/macOS.plymouth 100
|
||
|
sudo update-alternatives --config default.plymouth
|
||
|
sudo update-initramfs -u
|
||
|
}
|
||
|
|
||
|
# restore GNOME Shell Configuration
|
||
|
restore_gnome_shell_configuration() {
|
||
|
dconf load / < conf/gnome46-macos-ubuntu2404.conf
|
||
|
}
|
||
|
|
||
|
# Prompt for confirmation to quit session and handle user's choice
|
||
|
prompt_for_logout() {
|
||
|
clear
|
||
|
read -p "Setup completed successfully. Please logout and log back in for changes to take effect.(y/n): " choice
|
||
|
# Check user's choice
|
||
|
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
||
|
# Logout
|
||
|
gnome-session-quit --logout
|
||
|
else
|
||
|
clear
|
||
|
echo "No changes made. You can manually logout and log back in later."
|
||
|
fi
|
||
|
}
|
||
|
#start from here..
|
||
|
update_system
|
||
|
install_apps_and_dependencies
|
||
|
install_gnome_shell_extensions
|
||
|
install_whitesur_gtk_theme
|
||
|
install_whitesur_icon_theme
|
||
|
install_cursors_theme
|
||
|
install_fonts_and_wallpapers
|
||
|
install_cava_neofetch
|
||
|
install_zsh_oh_my_zsh
|
||
|
install_powerlevel10k_theme
|
||
|
enable_flatpak_and_appimage_support
|
||
|
install_flatpak_apps
|
||
|
install_gnome_apps
|
||
|
install_plymouth_macos_theme
|
||
|
restore_gnome_shell_configuration
|
||
|
#Ask user for confirmation to remove snap apps and daemon
|
||
|
clear
|
||
|
read -p "Remove snap apps and daemon recursively from your system and install firefox browser from Mozilla Repository [y/n]: " answer
|
||
|
if [[ "$answer" == "y" || "$answer" == "Y" ]]; then
|
||
|
remove_snap_and_prevent_reinstall
|
||
|
install_firefox_from_mozilla_ppa
|
||
|
install_whitesur_firefox_theme
|
||
|
sudo apt clean
|
||
|
clear
|
||
|
echo "DON'T FORGET: Run 'firefox -p' in the terminal. If you restore Firefox profile from Firefox Snap to New Firefox (DEB)"
|
||
|
read -p "Press any key to continue..."
|
||
|
clear
|
||
|
prompt_for_logout
|
||
|
else
|
||
|
prompt_for_logout
|
||
|
fi
|