Better installer and colors for most scripts.
This commit is contained in:
110
install.sh
110
install.sh
@@ -1,10 +1,12 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
source ./scripts/p.sh # Universal package manager
|
source ./scripts/p.sh
|
||||||
|
source ./scripts/color.sh
|
||||||
|
|
||||||
dist=$(d)
|
dist=$(d)
|
||||||
|
|
||||||
if [ $dist == 0 ]; then
|
if [ $dist == 0 ]; then
|
||||||
echo "ERROR - Distro not supported."
|
echo -e "${RED}[E] Distro not supported.${ENDCOLOR}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -21,94 +23,158 @@ function ask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Upgrade
|
# Upgrade
|
||||||
echo "Updating packages..."
|
echo -e "${GREEN}[+] Updating packages...${ENDCOLOR}"
|
||||||
p
|
p
|
||||||
p i git
|
|
||||||
|
# Install git
|
||||||
|
if p c git &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] git is installed.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}[+] Installing git...${ENDCOLOR}"
|
||||||
|
p i git
|
||||||
|
echo -e "${GREEN}[i] git installed.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Mirrors
|
# Mirrors
|
||||||
if [ $dist == 2 ]; then
|
if [ $dist == 2 ]; then
|
||||||
if ask "Choose best mirrors (LONG TIME)?"; then
|
if ask "Choose best mirrors (LONG TIME)?"; then
|
||||||
sudo pacman -S reflector
|
echo -e "${GREEN}[+] Choosing mirrors...${ENDCOLOR}"
|
||||||
|
p i reflector
|
||||||
sudo reflector --sort rate -p https --save /etc/pacman.d/mirrorlist --verbose
|
sudo reflector --sort rate -p https --save /etc/pacman.d/mirrorlist --verbose
|
||||||
read -p "Press enter to continue."
|
echo -e "${GREEN}[i] New mirrors applied.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install paru
|
# Install paru
|
||||||
if [ $dist == 2 ]; then
|
if [ $dist == 2 ]; then
|
||||||
paru=$(pacman -Q paru)
|
if p c paru &>/dev/null; then
|
||||||
if [[ -n "$paru" ]]; then
|
echo -e "${GREEN}[i] Paru is installed.${ENDCOLOR}"
|
||||||
echo -e "\e[32m[I] Paru is already installed.\e[0m"
|
|
||||||
else
|
else
|
||||||
|
echo -e "${GREEN}[+] Installing paru...${ENDCOLOR}"
|
||||||
sudo pacman -S --needed base-devel
|
sudo pacman -S --needed base-devel
|
||||||
git clone https://aur.archlinux.org/paru.git
|
git clone https://aur.archlinux.org/paru.git
|
||||||
cd paru
|
cd paru
|
||||||
makepkg -si
|
makepkg -si
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf paru
|
rm -rf paru
|
||||||
|
echo -e "${GREEN}[i] Paru installed.${ENDCOLOR}"
|
||||||
fi
|
fi
|
||||||
read -p "Press enter to continue."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable bluetooth support
|
# Enable bluetooth support
|
||||||
if [ $dist == 2 ]; then
|
if [ $dist == 2 ]; then
|
||||||
|
if p c bluetooth &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] Bluetooth is enabled.${ENDCOLOR}"
|
||||||
|
else
|
||||||
if ask "Enable bluetooth?"; then
|
if ask "Enable bluetooth?"; then
|
||||||
|
echo -e "${GREEN}[+] Installing bluetooth support...${ENDCOLOR}"
|
||||||
sudo pacman -S bluez bluez-utils
|
sudo pacman -S bluez bluez-utils
|
||||||
sudo systemctl start bluetooth.service
|
sudo systemctl start bluetooth.service
|
||||||
sudo systemctl enable bluetooth.service
|
sudo systemctl enable bluetooth.service
|
||||||
|
echo -e "${GREEN}[i] Bluetooth enabled.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable printer support
|
# Enable printer support
|
||||||
if [ $dist == 2 ]; then
|
if [ $dist == 2 ]; then
|
||||||
|
if p c cups &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] CUPS is enabled.${ENDCOLOR}"
|
||||||
|
else
|
||||||
if ask "Enable CUPS (printer)?"; then
|
if ask "Enable CUPS (printer)?"; then
|
||||||
|
echo -e "${GREEN}[+] Installing CUPS...${ENDCOLOR}"
|
||||||
sudo pacman -S cups
|
sudo pacman -S cups
|
||||||
sudo systemctl start cups
|
sudo systemctl start cups
|
||||||
sudo systemctl start cups.service
|
sudo systemctl start cups.service
|
||||||
sudo systemctl enable cups
|
sudo systemctl enable cups
|
||||||
sudo systemctl enable cups.service
|
sudo systemctl enable cups.service
|
||||||
|
echo -e "${GREEN}[i] CUPS enabled.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Icon theme
|
# Install Icon theme
|
||||||
echo "Installing Papirus Icon Theme..."
|
if ls /usr/share/icons/ | grep -i Papirus &>/dev/null; then
|
||||||
wget -qO- https://git.io/papirus-icon-theme-install | sh
|
echo -e "${GREEN}[i] Icon theme is installed.${ENDCOLOR}"
|
||||||
gsettings set org.gnome.desktop.interface icon-theme 'Papirus Dark'
|
else
|
||||||
|
echo -e "${GREEN}[+] Downloading Papirus icon theme...${ENDCOLOR}"
|
||||||
|
wget -qO- https://git.io/papirus-icon-theme-install | sh
|
||||||
|
gsettings set org.gnome.desktop.interface icon-theme 'Papirus Dark'
|
||||||
|
echo -e "${GREEN}[i] Theme is set.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Install Cursor theme
|
# Install Cursor theme
|
||||||
echo "Installing Cursor Theme..."
|
if ls /usr/share/icons/ | grep -i bibata &>/dev/null; then
|
||||||
p i bibata-cursor-theme
|
echo -e "${GREEN}[i] Cursor theme is installed.${ENDCOLOR}"
|
||||||
gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Modern-Classic'
|
else
|
||||||
|
echo -e "${GREEN}[+] Downloading Bibata cursor theme...${ENDCOLOR}"
|
||||||
|
p i bibata-cursor-theme
|
||||||
|
gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Modern-Classic'
|
||||||
|
echo -e "${GREEN}[i] Cursor theme set.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Install Nerd Font
|
# Install Nerd Font
|
||||||
echo "Installing JetBrains font..."
|
|
||||||
if [ $dist == 2 ]; then
|
if [ $dist == 2 ]; then
|
||||||
|
if p c ttf-jetbrains-mono-nerd &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] JetBrains font is installed.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}[+] Installing JetBrains font.${ENDCOLOR}"
|
||||||
p i ttf-jetbrains-mono-nerd
|
p i ttf-jetbrains-mono-nerd
|
||||||
|
echo -e "${GREEN}[i] JetBrains font installed.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
if p c fonts-jetbrains-mono &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] JetBrains font is installed.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}[+] Installing JetBrains font.${ENDCOLOR}"
|
||||||
p i fonts-jetbrains-mono
|
p i fonts-jetbrains-mono
|
||||||
|
echo -e "${GREEN}[i] JetBrains font installed.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable minimize button
|
# Enable minimize button
|
||||||
echo "Enabling minimize button..."
|
echo -e "${GREEN}[+] Adding the minimize button...${ENDCOLOR}"
|
||||||
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,close"
|
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,close"
|
||||||
|
|
||||||
# Enable flatpak support
|
# Enable flatpak support
|
||||||
if ask "Enable flatpak?"; then
|
if p c flatpak &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] Flatpaks are supported.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
if ask "Enable flatpak?"; then
|
||||||
|
echo -e "${GREEN}[+] Adding flatpak support...${ENDCOLOR}"
|
||||||
p i flatpak
|
p i flatpak
|
||||||
flatpak install flatseal
|
flatpak install flatseal
|
||||||
sudo flatpak override --filesystem=$HOME/.themes
|
sudo flatpak override --filesystem=$HOME/.themes
|
||||||
sudo flatpak override --filesystem=$HOME/.icons
|
sudo flatpak override --filesystem=$HOME/.icons
|
||||||
|
echo -e "${GREEN}[+] Flatpak support added.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Timeshift
|
# Install Timeshift
|
||||||
if ask "Install Timeshift?"; then
|
if p c flatpak &>/dev/null; then
|
||||||
|
echo -e "${GREEN}[i] Timeshift is installed.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
if ask "Install Timeshift?"; then
|
||||||
|
echo -e "${GREEN}[+] Installing Timeshift...${ENDCOLOR}"
|
||||||
p i timeshift
|
p i timeshift
|
||||||
sudo systemctl enable cronie
|
sudo systemctl enable cronie
|
||||||
sudo systemctl start cronie
|
sudo systemctl start cronie
|
||||||
|
echo -e "${GREEN}[i] Timeshift installed.${ENDCOLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[i] Cancelled.${ENDCOLOR}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy configs
|
# Copy configs
|
||||||
echo "Configuring system..."
|
echo -e "${GREEN}[+] Configuring system...${ENDCOLOR}"
|
||||||
cp -rf homeConfigs/.* ~
|
cp -rf homeConfigs/.* ~
|
||||||
|
|
||||||
# Enable bash case insensitive completion
|
# Enable bash case insensitive completion
|
||||||
@@ -116,3 +182,5 @@ cat /etc/inputrc | grep completion-ignore-case
|
|||||||
if [ $? == 1 ]; then
|
if [ $? == 1 ]; then
|
||||||
echo 'set completion-ignore-case On' | sudo tee -a /etc/inputrc
|
echo 'set completion-ignore-case On' | sudo tee -a /etc/inputrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -e "${GREEN}[i] All done.${ENDCOLOR}"
|
||||||
|
|||||||
37
scripts/p.sh
37
scripts/p.sh
@@ -1,6 +1,8 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# Cross-distro package manager wrapper
|
# Cross-distro package manager wrapper
|
||||||
|
|
||||||
|
source ~/dotfiles/scripts/color.sh
|
||||||
|
|
||||||
d() {
|
d() {
|
||||||
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
|
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
|
||||||
echo 1
|
echo 1
|
||||||
@@ -18,7 +20,7 @@ m() {
|
|||||||
elif [ $d == 1 ]; then
|
elif [ $d == 1 ]; then
|
||||||
~/dotfiles/scripts/debian-maintenance.sh
|
~/dotfiles/scripts/debian-maintenance.sh
|
||||||
else
|
else
|
||||||
echo "ERROR - Distro not supported."
|
echo -e "${RED}[E] Distro not supported.${ENDCOLOR}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -55,55 +57,56 @@ p() {
|
|||||||
|
|
||||||
# If no parameter
|
# If no parameter
|
||||||
if [ -z $1 ] || [ $1 == "u" ]; then
|
if [ -z $1 ] || [ $1 == "u" ]; then
|
||||||
echo "[+] Updating distro packages..."
|
echo -e "${GREEN}"[+] Updating distro packages..."${ENDCOLOR}"
|
||||||
$update
|
$update
|
||||||
if $flatpak; then
|
if $flatpak; then
|
||||||
echo
|
echo
|
||||||
echo "[+] Updating flatpaks..."
|
echo -e "${GREEN}"[+] Updating flatpaks..."${ENDCOLOR}"
|
||||||
flatpak upgrade
|
flatpak upgrade
|
||||||
fi
|
fi
|
||||||
echo "[I] done."
|
echo -e "${GREEN}"[i] done."${ENDCOLOR}"
|
||||||
return 0
|
return 0
|
||||||
elif [ $1 == "i" ]; then # If first parameter is i (install)
|
elif [ $1 == "i" ]; then # If first parameter is i (install)
|
||||||
echo "[+] Searching for $2 on the distro repos..."
|
echo -e "${GREEN}"[+] Searching for $2 on the distro repos..."${ENDCOLOR}"
|
||||||
$install $2 2>/dev/null
|
$install $2 2>/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "[I] $2 was installed."
|
echo -e "${GREEN}"[i] $2 installed."${ENDCOLOR}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
if $flatpak; then
|
if $flatpak; then
|
||||||
echo
|
echo
|
||||||
echo "[E] $2 not found."
|
echo -e "${YELLOW}"[E] $2 not found."${ENDCOLOR}"
|
||||||
echo "[+] Searching for $2 as a flatpak..."
|
echo -e "${GREEN}"[+] Searching for $2 as a flatpak..."${ENDCOLOR}"
|
||||||
echo
|
echo
|
||||||
flatpak install $2 2>/dev/null
|
flatpak install $2 2>/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "[I] $2 was installed."
|
echo -e "${GREEN}"[i] $2 installed."${ENDCOLOR}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "[E] $2 not found or already installed."
|
echo -e "${RED}"[E] $2 not found or already installed."${ENDCOLOR}"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
elif [ $1 == "r" ]; then # If first parameter is r (remove)
|
elif [ $1 == "r" ]; then # If first parameter is r (remove)
|
||||||
echo "[+] Removing $2..."
|
echo -e "${YELLOW}"[+] Removing $2..."${ENDCOLOR}"
|
||||||
$remove $2 2>/dev/null
|
$remove $2 2>/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "[I] $2 was removed."
|
echo -e "${GREEN}"[i] $2 removed."${ENDCOLOR}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
if $flatpak; then
|
if $flatpak; then
|
||||||
echo
|
echo
|
||||||
echo "[E] $2 not found."
|
echo -e "${YELLOW}"[E] $2 not found."${ENDCOLOR}"
|
||||||
echo "[+] Searching for $2 as a flatpak..."
|
echo "[+] Searching for $2 as a flatpak..."
|
||||||
|
echo -e "${GREEN}"[+] Searching for $2 as a flatpak..."${ENDCOLOR}"
|
||||||
echo
|
echo
|
||||||
flatpak remove $2 2>/dev/null
|
flatpak remove $2 2>/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "[I] $2 was removed."
|
echo -e "${GREEN}"[i] $2 removed."${ENDCOLOR}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "[E] $2 not found."
|
echo -e "${RED}"[E] $2 not found."${ENDCOLOR}"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
elif [ $1 == "c" ]; then # If first parameter is c (check)
|
elif [ $1 == "c" ]; then # If first parameter is c (check)
|
||||||
@@ -141,7 +144,7 @@ p() {
|
|||||||
echo 2
|
echo 2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "[I] Usage:"
|
echo -e "${YELLOW}"[i] Usage:"${ENDCOLOR}"
|
||||||
echo "p (u) -> update os"
|
echo "p (u) -> update os"
|
||||||
echo "p i package -> install package"
|
echo "p i package -> install package"
|
||||||
echo "p r package -> remove package"
|
echo "p r package -> remove package"
|
||||||
@@ -149,7 +152,7 @@ p() {
|
|||||||
echo "d -> returns 1 -> Debian; 2 -> Arch; 0 -> Error"
|
echo "d -> returns 1 -> Debian; 2 -> Arch; 0 -> Error"
|
||||||
echo "m -> maintenance script"
|
echo "m -> maintenance script"
|
||||||
echo
|
echo
|
||||||
echo "[I] Order of operations:"
|
echo -e "${YELLOW}"[i] Order of operations:"${ENDCOLOR}"
|
||||||
echo "1 - Check distro repos"
|
echo "1 - Check distro repos"
|
||||||
echo "2 - Check AUR if on Arch"
|
echo "2 - Check AUR if on Arch"
|
||||||
echo "3 - Check flatpaks (only if flatpak support is enabled)"
|
echo "3 - Check flatpaks (only if flatpak support is enabled)"
|
||||||
|
|||||||
Reference in New Issue
Block a user