fix all shellcheck warnings + formatting

This commit is contained in:
Jeevitha Kannan K S 2024-11-05 17:31:34 +05:30
parent 5878f4dbf0
commit d317d1e5cf
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
89 changed files with 871 additions and 901 deletions

View File

@ -6,15 +6,15 @@ installGithubDesktop() {
if ! command_exists github-desktop; then if ! command_exists github-desktop; then
printf "%b\n" "${YELLOW}Installing Github Desktop...${RC}" printf "%b\n" "${YELLOW}Installing Github Desktop...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://apt.packages.shiftkey.dev/gpg.key | gpg --dearmor | "$ESCALATION_TOOL" tee /usr/share/keyrings/shiftkey-packages.gpg > /dev/null curl -fsSL https://apt.packages.shiftkey.dev/gpg.key | gpg --dearmor | "$ESCALATION_TOOL" tee /usr/share/keyrings/shiftkey-packages.gpg >/dev/null
printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/shiftkey-packages.gpg] https://apt.packages.shiftkey.dev/ubuntu/ any main\n' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/shiftkey-packages.list > /dev/null printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/shiftkey-packages.gpg] https://apt.packages.shiftkey.dev/ubuntu/ any main\n' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/shiftkey-packages.list >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y github-desktop "$ESCALATION_TOOL" "$PACKAGER" install -y github-desktop
;; ;;
zypper) zypper)
"$ESCALATION_TOOL" rpm --import https://rpm.packages.shiftkey.dev/gpg.key "$ESCALATION_TOOL" rpm --import https://rpm.packages.shiftkey.dev/gpg.key
printf "%b\n" '[shiftkey-packages]\nname=GitHub Desktop\nbaseurl=https://rpm.packages.shiftkey.dev/rpm/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://rpm.packages.shiftkey.dev/gpg.key\n' | "$ESCALATION_TOOL" tee /etc/zypp/repos.d/shiftkey-packages.repo > /dev/null printf "%b\n" '[shiftkey-packages]\nname=GitHub Desktop\nbaseurl=https://rpm.packages.shiftkey.dev/rpm/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://rpm.packages.shiftkey.dev/gpg.key\n' | "$ESCALATION_TOOL" tee /etc/zypp/repos.d/shiftkey-packages.repo >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" refresh "$ESCALATION_TOOL" "$PACKAGER" refresh
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install github-desktop "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install github-desktop
;; ;;
@ -23,7 +23,7 @@ installGithubDesktop() {
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" rpm --import https://rpm.packages.shiftkey.dev/gpg.key "$ESCALATION_TOOL" rpm --import https://rpm.packages.shiftkey.dev/gpg.key
printf "%b\n" '[shiftkey-packages]\nname=GitHub Desktop\nbaseurl=https://rpm.packages.shiftkey.dev/rpm/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://rpm.packages.shiftkey.dev/gpg.key\n' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/shiftkey-packages.repo > /dev/null printf "%b\n" '[shiftkey-packages]\nname=GitHub Desktop\nbaseurl=https://rpm.packages.shiftkey.dev/rpm/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://rpm.packages.shiftkey.dev/gpg.key\n' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/shiftkey-packages.repo >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" install -y github-desktop "$ESCALATION_TOOL" "$PACKAGER" install -y github-desktop
;; ;;
*) *)

View File

@ -9,7 +9,7 @@ installMeld() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm meld "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm meld
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" -y install meld "$ESCALATION_TOOL" "$PACKAGER" -y install meld
;; ;;
*) *)

View File

@ -20,13 +20,13 @@ installNeovim() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y ripgrep fd-find python3-venv luarocks golang-go shellcheck git "$ESCALATION_TOOL" "$PACKAGER" install -y ripgrep fd-find python3-venv luarocks golang-go shellcheck git
curl -sSLo /tmp/nvim.appimage https://github.com/neovim/neovim/releases/latest/download/nvim.appimage curl -sSLo /tmp/nvim.appimage https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x /tmp/nvim.appimage chmod u+x /tmp/nvim.appimage
"$ESCALATION_TOOL" mv /tmp/nvim.appimage /usr/local/bin/nvim "$ESCALATION_TOOL" mv /tmp/nvim.appimage /usr/local/bin/nvim
;; ;;
dnf|zypper) dnf | zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git "$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
;; ;;
*) *)

View File

@ -6,7 +6,7 @@ installSublime() {
if ! command_exists sublime; then if ! command_exists sublime; then
printf "%b\n" "${YELLOW}Installing Sublime...${RC}" printf "%b\n" "${YELLOW}Installing Sublime...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | "$ESCALATION_TOOL" apt-key add - curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | "$ESCALATION_TOOL" apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/sublime-text.list echo "deb https://download.sublimetext.com/ apt/stable/" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/sublime-text.list
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update

View File

@ -6,17 +6,17 @@ installVsCode() {
if ! command_exists code; then if ! command_exists code; then
printf "%b\n" "${YELLOW}Installing VS Code..${RC}." printf "%b\n" "${YELLOW}Installing VS Code..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >packages.microsoft.gpg
"$ESCALATION_TOOL" install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg "$ESCALATION_TOOL" install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/vscode.list > /dev/null echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/vscode.list >/dev/null
rm -f packages.microsoft.gpg rm -f packages.microsoft.gpg
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y apt-transport-https code "$ESCALATION_TOOL" "$PACKAGER" install -y apt-transport-https code
;; ;;
zypper) zypper)
"$ESCALATION_TOOL" rpm --import https://packages.microsoft.com/keys/microsoft.asc "$ESCALATION_TOOL" rpm --import https://packages.microsoft.com/keys/microsoft.asc
printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/zypp/repos.d/vscode.repo > /dev/null printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/zypp/repos.d/vscode.repo >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" refresh "$ESCALATION_TOOL" "$PACKAGER" refresh
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install code "$ESCALATION_TOOL" "$PACKAGER" --non-interactive install code
;; ;;
@ -25,7 +25,7 @@ installVsCode() {
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" rpm --import https://packages.microsoft.com/keys/microsoft.asc "$ESCALATION_TOOL" rpm --import https://packages.microsoft.com/keys/microsoft.asc
printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/vscode.repo > /dev/null printf "%b\n" '[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc' | "$ESCALATION_TOOL" tee /etc/yum.repos.d/vscode.repo >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" install -y code "$ESCALATION_TOOL" "$PACKAGER" install -y code
;; ;;
*) *)

View File

@ -6,7 +6,7 @@ installVsCodium() {
if ! command_exists codium; then if ! command_exists codium; then
printf "%b\n" "${YELLOW}Installing VS Codium...${RC}" printf "%b\n" "${YELLOW}Installing VS Codium...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | "$ESCALATION_TOOL" dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg curl -fsSL https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | "$ESCALATION_TOOL" dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/vscodium.list echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/vscodium.list
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update

View File

@ -3,20 +3,20 @@
. ../common-script.sh . ../common-script.sh
install_adb() { install_adb() {
if ! command_exists adb ; then if ! command_exists adb; then
printf "%b\n" "${YELLOW}Installing ADB...${RC}." printf "%b\n" "${YELLOW}Installing ADB...${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y android-sdk-platform-tools "$ESCALATION_TOOL" "$PACKAGER" install -y android-sdk-platform-tools
;; ;;
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm android-tools "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm android-tools
;; ;;
dnf|zypper) dnf | zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y android-tools "$ESCALATION_TOOL" "$PACKAGER" install -y android-tools
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -6,7 +6,7 @@ installBrave() {
if ! command_exists brave; then if ! command_exists brave; then
printf "%b\n" "${YELLOW}Installing Brave...${RC}" printf "%b\n" "${YELLOW}Installing Brave...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl "$ESCALATION_TOOL" "$PACKAGER" install -y curl
"$ESCALATION_TOOL" curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg "$ESCALATION_TOOL" curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/brave-browser-release.list echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/brave-browser-release.list

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installChromium() { installChromium() {
if ! command_exists chromium; then if ! command_exists chromium; then
printf "%b\n" "${YELLOW}Installing Chromium...${RC}" printf "%b\n" "${YELLOW}Installing Chromium...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
@ -13,9 +13,9 @@ if ! command_exists chromium; then
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium "$ESCALATION_TOOL" "$PACKAGER" install -y chromium
;; ;;
esac esac
else else
printf "%b\n" "${GREEN}Chromium Browser is already installed.${RC}" printf "%b\n" "${GREEN}Chromium Browser is already installed.${RC}"
fi fi
} }
checkEnv checkEnv

View File

@ -6,7 +6,7 @@ installFirefox() {
if ! command_exists firefox; then if ! command_exists firefox; then
printf "%b\n" "${YELLOW}Installing Mozilla Firefox...${RC}" printf "%b\n" "${YELLOW}Installing Mozilla Firefox...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox-esr "$ESCALATION_TOOL" "$PACKAGER" install -y firefox-esr
;; ;;
zypper) zypper)

View File

@ -6,7 +6,7 @@ installChrome() {
if ! command_exists google-chrome; then if ! command_exists google-chrome; then
printf "%b\n" "${YELLOW}Installing Google Chrome...${RC}" printf "%b\n" "${YELLOW}Installing Google Chrome...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y ./google-chrome-stable_current_amd64.deb "$ESCALATION_TOOL" "$PACKAGER" install -y ./google-chrome-stable_current_amd64.deb
;; ;;

View File

@ -6,21 +6,21 @@ installLibreWolf() {
if ! command_exists librewolf; then if ! command_exists librewolf; then
printf "%b\n" "${YELLOW}Installing Librewolf...${RC}" printf "%b\n" "${YELLOW}Installing Librewolf...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates "$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates
distro=`if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then lsb_release -sc; else echo focal; fi` distro=$(if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then lsb_release -sc; else echo focal; fi)
curl -fsSL https://deb.librewolf.net/keyring.gpg | "$ESCALATION_TOOL" gpg --dearmor -o /usr/share/keyrings/librewolf.gpg curl -fsSL https://deb.librewolf.net/keyring.gpg | "$ESCALATION_TOOL" gpg --dearmor -o /usr/share/keyrings/librewolf.gpg
echo "Types: deb echo "Types: deb
URIs: https://deb.librewolf.net URIs: https://deb.librewolf.net
Suites: $distro Suites: $distro
Components: main Components: main
Architectures: amd64 Architectures: amd64
Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/librewolf.sources > /dev/null Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/librewolf.sources >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y librewolf "$ESCALATION_TOOL" "$PACKAGER" install -y librewolf
;; ;;
dnf) dnf)
curl -fsSL https://rpm.librewolf.net/librewolf-repo.repo | pkexec tee /etc/yum.repos.d/librewolf.repo > /dev/null curl -fsSL https://rpm.librewolf.net/librewolf-repo.repo | pkexec tee /etc/yum.repos.d/librewolf.repo >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" install -y librewolf "$ESCALATION_TOOL" "$PACKAGER" install -y librewolf
;; ;;
zypper) zypper)

View File

@ -6,13 +6,13 @@ installThrorium() {
if ! command_exists thorium-browser; then if ! command_exists thorium-browser; then
printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}" printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list "$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list
"$ESCALATION_TOOL" curl http://dl.thorium.rocks/debian/dists/stable/thorium.list -o /etc/apt/sources.list.d/thorium.list "$ESCALATION_TOOL" curl http://dl.thorium.rocks/debian/dists/stable/thorium.list -o /etc/apt/sources.list.d/thorium.list
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y thorium-browser "$ESCALATION_TOOL" "$PACKAGER" install -y thorium-browser
;; ;;
zypper|dnf) zypper | dnf)
url=$(curl -s https://api.github.com/repos/Alex313031/Thorium/releases/latest | grep -oP '(?<=browser_download_url": ")[^"]*\.rpm') url=$(curl -s https://api.github.com/repos/Alex313031/Thorium/releases/latest | grep -oP '(?<=browser_download_url": ")[^"]*\.rpm')
echo "$url" && curl -L "$url" -o thorium-latest.rpm echo "$url" && curl -L "$url" -o thorium-latest.rpm
"$ESCALATION_TOOL" "$PACKAGER" install -y thorium-latest.rpm && rm thorium-latest.rpm "$ESCALATION_TOOL" "$PACKAGER" install -y thorium-latest.rpm && rm thorium-latest.rpm

View File

@ -6,7 +6,7 @@ installVivaldi() {
if ! command_exists vivaldi; then if ! command_exists vivaldi; then
printf "%b\n" "${YELLOW}Installing Vivaldi...${RC}" printf "%b\n" "${YELLOW}Installing Vivaldi...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl "$ESCALATION_TOOL" "$PACKAGER" install -y curl
"$ESCALATION_TOOL" curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg "$ESCALATION_TOOL" curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg
"$ESCALATION_TOOL" echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list "$ESCALATION_TOOL" echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list

View File

@ -6,7 +6,7 @@ installDiscord() {
if ! command_exists discord; then if ! command_exists discord; then
printf "%b\n" "${YELLOW}Installing Discord...${RC}" printf "%b\n" "${YELLOW}Installing Discord...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -Lo discord.deb "https://discord.com/api/download?platform=linux&format=deb" curl -Lo discord.deb "https://discord.com/api/download?platform=linux&format=deb"
"$ESCALATION_TOOL" "$PACKAGER" install -y discord.deb "$ESCALATION_TOOL" "$PACKAGER" install -y discord.deb
;; ;;
@ -17,11 +17,11 @@ installDiscord() {
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm discord "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm discord
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm "$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
"$ESCALATION_TOOL" "$PACKAGER" install -y discord "$ESCALATION_TOOL" "$PACKAGER" install -y discord
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -6,9 +6,9 @@ installJitsi() {
if ! command_exists jitsi-meet; then if ! command_exists jitsi-meet; then
printf "%b\n" "${YELLOW}Installing Jitsi meet...${RC}" printf "%b\n" "${YELLOW}Installing Jitsi meet...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl https://download.jitsi.org/jitsi-key.gpg.key | "$ESCALATION_TOOL" gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg curl https://download.jitsi.org/jitsi-key.gpg.key | "$ESCALATION_TOOL" gpg --dearmor >/usr/share/keyrings/jitsi-keyring.gpg
printf "%b\n" 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null printf "%b\n" 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/jitsi-stable.list >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" -y install jitsi-meet "$ESCALATION_TOOL" "$PACKAGER" -y install jitsi-meet
;; ;;

View File

@ -6,9 +6,8 @@ installSignal() {
if ! command_exists org.signal.Signal && ! command_exists signal; then if ! command_exists org.signal.Signal && ! command_exists signal; then
printf "%b\n" "${YELLOW}Installing Signal...${RC}" printf "%b\n" "${YELLOW}Installing Signal...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg curl -fsSL https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor | "$ESCALATION_TOOL" tee /usr/share/keyrings/signal-desktop-keyring.gpg >/dev/null
cat signal-desktop-keyring.gpg | "$ESCALATION_TOOL" tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/signal-xenial.list printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/signal-xenial.list
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" -y install signal-desktop "$ESCALATION_TOOL" "$PACKAGER" -y install signal-desktop

View File

@ -13,17 +13,29 @@ choose_installation() {
read -r CHOICE read -r CHOICE
case "$CHOICE" in case "$CHOICE" in
1) INSTALL_DOCKER=1; INSTALL_COMPOSE=0 ;; 1)
2) INSTALL_DOCKER=0; INSTALL_COMPOSE=1 ;; INSTALL_DOCKER=1
3) INSTALL_DOCKER=1; INSTALL_COMPOSE=1 ;; INSTALL_COMPOSE=0
*) printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"; exit 1 ;; ;;
2)
INSTALL_DOCKER=0
INSTALL_COMPOSE=1
;;
3)
INSTALL_DOCKER=1
INSTALL_COMPOSE=1
;;
*)
printf "%b\n" "${RED}Invalid choice. Exiting.${RC}"
exit 1
;;
esac esac
} }
install_docker() { install_docker() {
printf "%b\n" "${YELLOW}Installing Docker...${RC}" printf "%b\n" "${YELLOW}Installing Docker...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -fsSL https://get.docker.com | sh curl -fsSL https://get.docker.com | sh
;; ;;
dnf) dnf)
@ -52,7 +64,7 @@ install_docker() {
install_docker_compose() { install_docker_compose() {
printf "%b\n" "${YELLOW}Installing Docker Compose...${RC}" printf "%b\n" "${YELLOW}Installing Docker Compose...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin "$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
;; ;;
dnf) dnf)

View File

@ -8,7 +8,7 @@ setupDWM() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git unzip flameshot lxappearance feh mate-polkit
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git unzip flameshot lxappearance feh mate-polkit "$ESCALATION_TOOL" "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git unzip flameshot lxappearance feh mate-polkit
;; ;;
dnf) dnf)
@ -105,7 +105,10 @@ picom_animations() {
printf "%b\n" "${GREEN}Repository already exists, skipping clone${RC}" printf "%b\n" "${GREEN}Repository already exists, skipping clone${RC}"
fi fi
cd "$HOME/.local/share/ftlabs-picom" || { printf "%b\n" "${RED}Failed to change directory to picom${RC}"; return 1; } cd "$HOME/.local/share/ftlabs-picom" || {
printf "%b\n" "${RED}Failed to change directory to picom${RC}"
return 1
}
# Build the project # Build the project
if ! meson setup --buildtype=release build; then if ! meson setup --buildtype=release build; then
@ -185,14 +188,14 @@ setupDisplayManager() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm xorg-xinit xorg-server
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg xinit "$ESCALATION_TOOL" "$PACKAGER" install -y xorg xinit
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg "$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac
@ -219,14 +222,14 @@ setupDisplayManager() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$DM"
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM" "$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
;; ;;
dnf) dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM" "$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac
@ -241,7 +244,10 @@ install_slstatus() {
read -r response # -r flag to prevent backslashes from being interpreted read -r response # -r flag to prevent backslashes from being interpreted
if [ "$response" = "y" ] || [ "$response" = "Y" ]; then if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
printf "%b\n" "${YELLOW}Installing slstatus${RC}" printf "%b\n" "${YELLOW}Installing slstatus${RC}"
cd "$HOME/dwm-titus/slstatus" || { printf "%b\n" "${RED}Failed to change directory to slstatus${RC}"; return 1; } cd "$HOME/dwm-titus/slstatus" || {
printf "%b\n" "${RED}Failed to change directory to slstatus${RC}"
return 1
}
if "$ESCALATION_TOOL" make clean install; then if "$ESCALATION_TOOL" make clean install; then
printf "%b\n" "${GREEN}slstatus installed successfully${RC}" printf "%b\n" "${GREEN}slstatus installed successfully${RC}"
else else

View File

@ -9,7 +9,7 @@ installFastfetch() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
;; ;;
apt-get|nala) apt-get | nala)
curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb "$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb
rm /tmp/fastfetch.deb rm /tmp/fastfetch.deb

View File

@ -2,7 +2,7 @@
. ../common-script.sh . ../common-script.sh
themeinstall(){ themeinstall() {
mkdir -p "$HOME/.local/share" mkdir -p "$HOME/.local/share"
cd "$HOME/.local/share" cd "$HOME/.local/share"
if [ -d 'Top-5-Bootloader-Themes' ]; then if [ -d 'Top-5-Bootloader-Themes' ]; then

View File

@ -2,6 +2,7 @@
. ../common-script.sh . ../common-script.sh
#shellcheck disable=SC1091
installLinutil() { installLinutil() {
printf "%b\n" "${YELLOW}Installing Linutil...${RC}" printf "%b\n" "${YELLOW}Installing Linutil...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
@ -30,7 +31,7 @@ installLinutil() {
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}" printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}"
read -r choice read -r choice
case $choice in case $choice in
y|Y) y | Y)
if ! command_exists cargo; then if ! command_exists cargo; then
printf "%b\n" "${YELLOW}Installing rustup...${RC}" printf "%b\n" "${YELLOW}Installing rustup...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
@ -43,11 +44,11 @@ installLinutil() {
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make "$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. $HOME/.cargo/env . "$HOME/.cargo/env"
;; ;;
*) *)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. $HOME/.cargo/env . "$HOME/.cargo/env"
;; ;;
esac esac
fi fi
@ -58,16 +59,17 @@ installLinutil() {
;; ;;
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;; *) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
esac esac
;;
esac esac
} }
installExtra() { installExtra() {
printf "%b\n" "${YELLOW}Installing the manpage...${RC}" printf "%b\n" "${YELLOW}Installing the manpage...${RC}"
"$ESCALATION_TOOL" mkdir -p /usr/share/man/man1 "$ESCALATION_TOOL" mkdir -p /usr/share/man/man1
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' > /dev/null curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/man/linutil.1' | "$ESCALATION_TOOL" tee '/usr/share/man/man1/linutil.1' >/dev/null
printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}" printf "%b\n" "${YELLOW}Creating a Desktop Entry...${RC}"
"$ESCALATION_TOOL" mkdir -p /usr/share/applications "$ESCALATION_TOOL" mkdir -p /usr/share/applications
curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop > /dev/null curl 'https://raw.githubusercontent.com/ChrisTitusTech/linutil/refs/heads/main/linutil.desktop' | "$ESCALATION_TOOL" tee /usr/share/applications/linutil.desktop >/dev/null
printf "%b\n" "${GREEN}Done.${RC}" printf "%b\n" "${GREEN}Done.${RC}"
} }

View File

@ -2,6 +2,7 @@
. ../common-script.sh . ../common-script.sh
#shellcheck disable=SC1091
updateLinutil() { updateLinutil() {
if [ ! -e "$HOME/.cargo/bin/linutil" ]; then if [ ! -e "$HOME/.cargo/bin/linutil" ]; then
printf "%b\n" "${RED}This script only updates the binary installed through cargo.\nlinutil_tui is not installed.${RC}" printf "%b\n" "${RED}This script only updates the binary installed through cargo.\nlinutil_tui is not installed.${RC}"
@ -17,7 +18,7 @@ updateLinutil() {
zypper) zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make "$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. $HOME/.cargo/env . "$HOME/.cargo/env"
;; ;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup "$ESCALATION_TOOL" "$PACKAGER" install -y rustup

View File

@ -6,7 +6,7 @@ installFreeOffice() {
if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then
printf "%b\n" "${YELLOW}Installing Free Office...${RC}" printf "%b\n" "${YELLOW}Installing Free Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -O https://www.softmaker.net/down/softmaker-freeoffice-2024_1218-01_amd64.deb curl -O https://www.softmaker.net/down/softmaker-freeoffice-2024_1218-01_amd64.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y ./softmaker-freeoffice-2024_1218-01_amd64.deb "$ESCALATION_TOOL" "$PACKAGER" install -y ./softmaker-freeoffice-2024_1218-01_amd64.deb
;; ;;

View File

@ -6,10 +6,10 @@ installLibreOffice() {
if ! command_exists org.libreoffice.LibreOffice && ! command_exists libreoffice; then if ! command_exists org.libreoffice.LibreOffice && ! command_exists libreoffice; then
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}" printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core "$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
;; ;;
zypper|dnf) zypper | dnf)
checkFlatpak checkFlatpak
flatpak install -y flathub org.libreoffice.LibreOffice flatpak install -y flathub org.libreoffice.LibreOffice
;; ;;

View File

@ -6,11 +6,11 @@ installOnlyOffice() {
if ! command_exists org.onlyoffice.desktopeditors && ! command_exists onlyoffice-desktopeditors; then if ! command_exists org.onlyoffice.desktopeditors && ! command_exists onlyoffice-desktopeditors; then
printf "%b\n" "${YELLOW}Installing Only Office..${RC}." printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb "$ESCALATION_TOOL" "$PACKAGER" install -y ./onlyoffice-desktopeditors_amd64.deb
;; ;;
zypper|dnf) zypper | dnf)
checkFlatpak checkFlatpak
flatpak install -y flathub org.onlyoffice.desktopeditors flatpak install -y flathub org.onlyoffice.desktopeditors
;; ;;

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
checkGpu() { checkGpu() {
if lspci | grep -i nvidia > /dev/null; then if lspci | grep -i nvidia >/dev/null; then
printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}" printf "%b\n" "${RED}Waydroid is not compatible with NVIDIA GPUs.${RC}"
exit 1 exit 1
fi fi
@ -27,7 +27,7 @@ installWaydroid() {
"$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms "$AUR_HELPER" -S --needed --noconfirm binder_linux-dkms
"$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder "$ESCALATION_TOOL" modprobe binder-linux device=binder,hwbinder,vndbinder
;; ;;
apt-get|nala) apt-get | nala)
curl https://repo.waydro.id | "$ESCALATION_TOOL" sh curl https://repo.waydro.id | "$ESCALATION_TOOL" sh
"$ESCALATION_TOOL" "$PACKAGER" install -y waydroid "$ESCALATION_TOOL" "$PACKAGER" install -y waydroid
if command_exists dkms; then if command_exists dkms; then

View File

@ -9,11 +9,11 @@ CYAN='\033[36m'
GREEN='\033[32m' GREEN='\033[32m'
command_exists() { command_exists() {
for cmd in "$@"; do for cmd in "$@"; do
export PATH=/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH export PATH="/home/jeeva/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH"
command -v "$cmd" >/dev/null 2>&1 || return 1 command -v "$cmd" >/dev/null 2>&1 || return 1
done done
return 0 return 0
} }
checkFlatpak() { checkFlatpak() {
@ -160,6 +160,7 @@ checkDistro() {
DTYPE="unknown" # Default to unknown DTYPE="unknown" # Default to unknown
# Use /etc/os-release for modern distro identification # Use /etc/os-release for modern distro identification
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
# shellcheck disable=SC1091
. /etc/os-release . /etc/os-release
DTYPE=$ID DTYPE=$ID
fi fi

View File

@ -86,7 +86,7 @@ select_option() {
fi fi
done done
last_selected=$selected last_selected="$selected"
# Read user input # Read user input
read -rsn1 key read -rsn1 key
@ -96,13 +96,13 @@ select_option() {
case $key in case $key in
'[A') # Up arrow '[A') # Up arrow
((selected--)) ((selected--))
if [ $selected -lt 0 ]; then if [ "$selected" -lt 0 ]; then
selected=$((num_options - 1)) selected=$((num_options - 1))
fi fi
;; ;;
'[B') # Down arrow '[B') # Down arrow
((selected++)) ((selected++))
if [ $selected -ge $num_options ]; then if [ "$selected" -ge "$num_options" ]; then
selected=0 selected=0
fi fi
;; ;;
@ -119,9 +119,9 @@ select_option() {
# @description Displays ArchTitus logo # @description Displays ArchTitus logo
# @noargs # @noargs
logo () { logo() {
# This will be shown on every set as user is progressing # This will be shown on every set as user is progressing
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
@ -136,7 +136,7 @@ echo -ne "
} }
# @description This function will handle file systems. At this movement we are handling only # @description This function will handle file systems. At this movement we are handling only
# btrfs and ext4. Others will be added in future. # btrfs and ext4. Others will be added in future.
filesystem () { filesystem() {
echo -ne " echo -ne "
Please Select your file system for both boot and root Please Select your file system for both boot and root
" "
@ -144,19 +144,22 @@ filesystem () {
select_option "${options[@]}" select_option "${options[@]}"
case $? in case $? in
0) export FS=btrfs;; 0) export FS=btrfs ;;
1) export FS=ext4;; 1) export FS=ext4 ;;
2) 2)
set_password "LUKS_PASSWORD" set_password "LUKS_PASSWORD"
export FS=luks export FS=luks
;; ;;
3) exit ;; 3) exit ;;
*) echo "Wrong option please select again"; filesystem;; *)
echo "Wrong option please select again"
filesystem
;;
esac esac
} }
# @description Detects and sets timezone. # @description Detects and sets timezone.
timezone () { timezone() {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time # Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)" time_zone="$(curl --fail https://ipapi.co/timezone)"
echo -ne " echo -ne "
@ -167,23 +170,28 @@ timezone () {
select_option "${options[@]}" select_option "${options[@]}"
case ${options[$?]} in case ${options[$?]} in
y|Y|yes|Yes|YES) y | Y | yes | Yes | YES)
echo "${time_zone} set as timezone" echo "${time_zone} set as timezone"
export TIMEZONE=$time_zone;; export TIMEZONE=$time_zone
n|N|no|NO|No) ;;
n | N | no | NO | No)
echo "Please enter your desired timezone e.g. Europe/London :" echo "Please enter your desired timezone e.g. Europe/London :"
read -r new_timezone read -r new_timezone
echo "${new_timezone} set as timezone" echo "${new_timezone} set as timezone"
export TIMEZONE=$new_timezone;; export TIMEZONE=$new_timezone
*) echo "Wrong option. Try again";timezone;; ;;
*)
echo "Wrong option. Try again"
timezone
;;
esac esac
} }
# @description Set user's keyboard mapping. # @description Set user's keyboard mapping.
keymap () { keymap() {
echo -ne " echo -ne "
Please select key board layout from this list" Please select key board layout from this list"
# These are default key maps as presented in official arch repo archinstall # These are default key maps as presented in official arch repo archinstall
options=(us by ca cf cz de dk es et fa fi fr gr hu il it lt lv mk nl no pl ro ru se sg ua uk) options=('us' 'by' 'ca' 'cf' 'cz' 'de' 'dk' 'es' 'et' 'fa' 'fi' 'fr' 'gr' 'hu' 'il' 'it' 'lt' 'lv' 'mk' 'nl' 'no' 'pl' 'ro' 'ru' 'se' 'sg' 'ua' 'uk')
select_option "${options[@]}" select_option "${options[@]}"
keymap=${options[$?]} keymap=${options[$?]}
@ -193,7 +201,7 @@ keymap () {
} }
# @description Choose whether drive is SSD or not. # @description Choose whether drive is SSD or not.
drivessd () { drivessd() {
echo -ne " echo -ne "
Is this an ssd? yes/no: Is this an ssd? yes/no:
" "
@ -202,17 +210,22 @@ drivessd () {
select_option "${options[@]}" select_option "${options[@]}"
case ${options[$?]} in case ${options[$?]} in
y|Y|yes|Yes|YES) y | Y | yes | Yes | YES)
export MOUNT_OPTIONS="noatime,compress=zstd,ssd,commit=120";; export MOUNT_OPTIONS="noatime,compress=zstd,ssd,commit=120"
n|N|no|NO|No) ;;
export MOUNT_OPTIONS="noatime,compress=zstd,commit=120";; n | N | no | NO | No)
*) echo "Wrong option. Try again";drivessd;; export MOUNT_OPTIONS="noatime,compress=zstd,commit=120"
;;
*)
echo "Wrong option. Try again"
drivessd
;;
esac esac
} }
# @description Disk selection for drive to be used with installation. # @description Disk selection for drive to be used with installation.
diskpart () { diskpart() {
echo -ne " echo -ne "
------------------------------------------------------------------------ ------------------------------------------------------------------------
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
Please make sure you know what you are doing because Please make sure you know what you are doing because
@ -225,6 +238,7 @@ echo -ne "
PS3=' PS3='
Select the disk to install on: ' Select the disk to install on: '
# shellcheck disable=SC2207
options=($(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}')) options=($(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}'))
select_option "${options[@]}" select_option "${options[@]}"
@ -237,21 +251,18 @@ echo -ne "
} }
# @description Gather username and password to be used for installation. # @description Gather username and password to be used for installation.
userinfo () { userinfo() {
# Loop through user input until the user gives a valid username # Loop through user input until the user gives a valid username
while true while true; do
do
read -r -p "Please enter username: " username read -r -p "Please enter username: " username
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]] if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then
then
break break
fi fi
echo "Incorrect username." echo "Incorrect username."
done done
export USERNAME=$username export USERNAME=$username
while true while true; do
do
read -rs -p "Please enter password: " PASSWORD1 read -rs -p "Please enter password: " PASSWORD1
echo -ne "\n" echo -ne "\n"
read -rs -p "Please re-enter password: " PASSWORD2 read -rs -p "Please re-enter password: " PASSWORD2
@ -265,18 +276,15 @@ userinfo () {
export PASSWORD=$PASSWORD1 export PASSWORD=$PASSWORD1
# Loop through user input until the user gives a valid hostname, but allow the user to force save # Loop through user input until the user gives a valid hostname, but allow the user to force save
while true while true; do
do
read -r -p "Please name your machine: " name_of_machine read -r -p "Please name your machine: " name_of_machine
# hostname regex (!!couldn't find spec for computer name!!) # hostname regex (!!couldn't find spec for computer name!!)
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]] if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then
then
break break
fi fi
# if validation fails allow the user to force saving of the hostname # if validation fails allow the user to force saving of the hostname
read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
if [[ "${force,,}" = "y" ]] if [[ "${force,,}" = "y" ]]; then
then
break break
fi fi
done done
@ -352,27 +360,27 @@ echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
# @description Creates the btrfs subvolumes. # @description Creates the btrfs subvolumes.
createsubvolumes () { createsubvolumes() {
btrfs subvolume create /mnt/@ btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home btrfs subvolume create /mnt/@home
} }
# @description Mount all btrfs subvolumes after root has been mounted. # @description Mount all btrfs subvolumes after root has been mounted.
mountallsubvol () { mountallsubvol() {
mount -o "${MOUNT_OPTIONS}",subvol=@home "${partition3}" /mnt/home mount -o "${MOUNT_OPTIONS}",subvol=@home "${partition3}" /mnt/home
} }
# @description BTRFS subvolulme creation and mounting. # @description BTRFS subvolulme creation and mounting.
subvolumesetup () { subvolumesetup() {
# create nonroot subvolumes # create nonroot subvolumes
createsubvolumes createsubvolumes
# unmount root to remount with subvolume # unmount root to remount with subvolume
umount /mnt umount /mnt
# mount @ subvolume # mount @ subvolume
mount -o "${MOUNT_OPTIONS}",subvol=@ "${partition3}" /mnt mount -o "${MOUNT_OPTIONS}",subvol=@ "${partition3}" /mnt
# make directories home, .snapshots, var, tmp # make directories home, .snapshots, var, tmp
mkdir -p /mnt/home mkdir -p /mnt/home
# mount subvolumes # mount subvolumes
mountallsubvol mountallsubvol
} }
@ -395,13 +403,13 @@ elif [[ "${FS}" == "ext4" ]]; then
mount -t ext4 "${partition3}" /mnt mount -t ext4 "${partition3}" /mnt
elif [[ "${FS}" == "luks" ]]; then elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 "${partition2}" mkfs.vfat -F32 "${partition2}"
# enter luks password to cryptsetup and format root partition # enter luks password to cryptsetup and format root partition
echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat "${partition3}" - echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat "${partition3}" -
# open luks container and ROOT will be place holder # open luks container and ROOT will be place holder
echo -n "${LUKS_PASSWORD}" | cryptsetup open "${partition3}" ROOT - echo -n "${LUKS_PASSWORD}" | cryptsetup open "${partition3}" ROOT -
# now format that container # now format that container
mkfs.btrfs "${partition3}" mkfs.btrfs "${partition3}"
# create subvolumes for btrfs # create subvolumes for btrfs
mount -t btrfs "${partition3}" /mnt mount -t btrfs "${partition3}" /mnt
subvolumesetup subvolumesetup
ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value "${partition3}") ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value "${partition3}")
@ -435,10 +443,10 @@ if [[ ! -d "/sys/firmware/efi" ]]; then
else else
pacstrap /mnt base base-devel linux-lts linux-firmware efibootmgr --noconfirm --needed pacstrap /mnt base base-devel linux-lts linux-firmware efibootmgr --noconfirm --needed
fi fi
echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf echo "keyserver hkp://keyserver.ubuntu.com" >>/mnt/etc/pacman.d/gnupg/gpg.conf
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
genfstab -U /mnt >> /mnt/etc/fstab genfstab -U /mnt >>/mnt/etc/fstab
echo " echo "
Generated /etc/fstab: Generated /etc/fstab:
" "
@ -456,7 +464,7 @@ echo -ne "
Checking for low memory systems <8G Checking for low memory systems <8G
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') TOTAL_MEM=$(grep -i 'memtotal' /proc/meminfo | grep -o '[[:digit:]]*')
if [[ $TOTAL_MEM -lt 8000000 ]]; then if [[ $TOTAL_MEM -lt 8000000 ]]; then
# Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything. # Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything.
mkdir -p /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly. mkdir -p /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
@ -469,11 +477,12 @@ if [[ $TOTAL_MEM -lt 8000000 ]]; then
mkswap /mnt/opt/swap/swapfile mkswap /mnt/opt/swap/swapfile
swapon /mnt/opt/swap/swapfile swapon /mnt/opt/swap/swapfile
# The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself. # The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself.
echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation. echo "/opt/swap/swapfile none swap sw 0 0" >>/mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
fi fi
gpu_type=$(lspci | grep -E "VGA|3D|Display") gpu_type=$(lspci | grep -E "VGA|3D|Display")
# shellcheck disable=SC2154
arch-chroot /mnt /bin/bash -c "KEYMAP='${KEYMAP}' /bin/bash" <<EOF arch-chroot /mnt /bin/bash -c "KEYMAP='${KEYMAP}' /bin/bash" <<EOF
echo -ne " echo -ne "
@ -500,7 +509,7 @@ echo -ne "
changing the compression settings. changing the compression settings.
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') TOTAL_MEM=$(grep -i 'memtotal' /proc/meminfo | grep -o '[[:digit:]]*')
if [[ $TOTAL_MEM -gt 8000000 ]]; then if [[ $TOTAL_MEM -gt 8000000 ]]; then
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf

View File

@ -2,8 +2,8 @@
. ../common-script.sh . ../common-script.sh
# shellcheck disable=SC2086
installDepend() { installDepend() {
## Check for dependencies.
DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq' DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}" printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
@ -17,7 +17,7 @@ installDepend() {
fi fi
"$AUR_HELPER" -S --needed --noconfirm $DEPENDENCIES "$AUR_HELPER" -S --needed --noconfirm $DEPENDENCIES
;; ;;
apt-get|nala) apt-get | nala)
COMPILEDEPS='build-essential' COMPILEDEPS='build-essential'
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" dpkg --add-architecture i386 "$ESCALATION_TOOL" dpkg --add-architecture i386

View File

@ -6,9 +6,9 @@ configureDNF() {
case "$PACKAGER" in case "$PACKAGER" in
dnf) dnf)
printf "%b\n" "${YELLOW}Configuring DNF...${RC}" printf "%b\n" "${YELLOW}Configuring DNF...${RC}"
"$ESCALATION_TOOL" sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf "$ESCALATION_TOOL" sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >>/etc/dnf/dnf.conf
echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf >/dev/null
echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf >/dev/null
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
printf "%b\n" "${GREEN}DNF Configured Successfully.${RC}" printf "%b\n" "${GREEN}DNF Configured Successfully.${RC}"
;; ;;

View File

@ -14,7 +14,7 @@ update() {
read -r response read -r response
case "$response" in case "$response" in
y|Y) y | Y)
printf "%b\n" "${CYAN}Preparing to update to $next_version...${RC}" printf "%b\n" "${CYAN}Preparing to update to $next_version...${RC}"
if ! "$ESCALATION_TOOL" "$PACKAGER" install dnf-plugin-system-upgrade -y; then if ! "$ESCALATION_TOOL" "$PACKAGER" install dnf-plugin-system-upgrade -y; then
@ -22,7 +22,7 @@ update() {
exit 1 exit 1
fi fi
if ! "$ESCALATION_TOOL" "$PACKAGER" system-upgrade download --releasever="$next_version" -y ; then if ! "$ESCALATION_TOOL" "$PACKAGER" system-upgrade download --releasever="$next_version" -y; then
printf "%b\n" "${RED}Failed to download the upgrade packages.${RC}" printf "%b\n" "${RED}Failed to download the upgrade packages.${RC}"
exit 1 exit 1
fi fi
@ -31,7 +31,7 @@ update() {
read -r reboot_response read -r reboot_response
case "$reboot_response" in case "$reboot_response" in
y|Y) y | Y)
printf "%b\n" "${YELLOW}Rebooting to apply the upgrade...${RC}" printf "%b\n" "${YELLOW}Rebooting to apply the upgrade...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" system-upgrade reboot "$ESCALATION_TOOL" "$PACKAGER" system-upgrade reboot
;; ;;

View File

@ -1,6 +1,7 @@
#!/bin/sh -e #!/bin/sh -e
. ../../common-script.sh . ../../common-script.sh
# This script allows user to download proprietary drivers for nvidia in fedora # This script allows user to download proprietary drivers for nvidia in fedora
# It also disables nouveau nvidia drivers # It also disables nouveau nvidia drivers
@ -17,13 +18,9 @@ checkRepo() {
else else
printf "%b\n" "${YELLOW}Nvidia non-free repository is not enabled. Enabling now...${RC}" printf "%b\n" "${YELLOW}Nvidia non-free repository is not enabled. Enabling now...${RC}"
# Enable the repository
"$ESCALATION_TOOL" dnf config-manager --set-enabled "$REPO_ID" "$ESCALATION_TOOL" dnf config-manager --set-enabled "$REPO_ID"
# Refreshing repository list
"$ESCALATION_TOOL" dnf makecache "$ESCALATION_TOOL" dnf makecache
# Verify if the repository is enabled
if [ "$(dnf repolist enabled 2>/dev/null | grep -c "$REPO_ID")" -gt 0 ]; then if [ "$(dnf repolist enabled 2>/dev/null | grep -c "$REPO_ID")" -gt 0 ]; then
printf "%b\n" "${GREEN}Nvidia non-free repository is now enabled...${RC}" printf "%b\n" "${GREEN}Nvidia non-free repository is now enabled...${RC}"
else else
@ -48,11 +45,10 @@ installDriver() {
exit 0 exit 0
fi fi
# NOTE:: Installing graphics driver.
"$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y "$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}" printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}"
for i in $(seq 1 5); do for _ in $(seq 1 5); do
if checkDriverInstallation; then if checkDriverInstallation; then
printf "%b\n" "${GREEN}Driver installed successfully.${RC}" printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
printf "%b\n" "${GREEN}Installed driver version $(modinfo -F version nvidia)${RC}" printf "%b\n" "${GREEN}Installed driver version $(modinfo -F version nvidia)${RC}"
@ -66,7 +62,6 @@ installDriver() {
} }
# NOTE: A confirmation option to proceed or not
userConfirmation() { userConfirmation() {
printf "%b" "${YELLOW}Do you want to continue? (y/N): ${RC}" printf "%b" "${YELLOW}Do you want to continue? (y/N): ${RC}"
read -r choice read -r choice
@ -77,17 +72,17 @@ userConfirmation() {
return return
;; ;;
n | N) n | N)
printf "%b\n" "${RED} Exiting the Script ${RC}" printf "%b\n" "${RED}Exiting the script.${RC}"
return return
;; ;;
*) *)
printf "%b\n" "${RED} Invalid Option! ${RC}" printf "%b\n" "${RED}Invalid Option!${RC}"
userConfirmation userConfirmation
;; ;;
esac esac
} }
printf "%b\n" "${YELLOW}Warning! This script will enable Nvidia non-free repository and only install drivers for GPUs from 2014 or later. It works on fedora 34 and above.\n It is recommended remove this driver while updating your kernel packages to newer version.${RC}" printf "%b\n" "${YELLOW}Warning! This script will enable nvidia non-free repository and only install drivers for GPUs from 2014 or later. It works on fedora 34 and above.\n It is recommended remove this driver while updating your kernel packages to newer version.${RC}"
checkEnv checkEnv
checkEscalationTool checkEscalationTool

View File

@ -1,14 +1,14 @@
#!/bin/sh -e #!/bin/sh -e
# shellcheck disable=SC2086
. ../common-script.sh . ../common-script.sh
installDepend() { installDepend() {
# Check for dependencies
DEPENDENCIES='wine dbus' DEPENDENCIES='wine dbus'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}" printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
#Check for multilib
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
echo "[multilib]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf echo "[multilib]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf echo "Include = /etc/pacman.d/mirrorlist" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
@ -25,7 +25,7 @@ installDepend() {
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS $AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
;; ;;
apt-get|nala) apt-get | nala)
DISTRO_DEPS="libasound2 libsdl2 wine64 wine32" DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
@ -61,7 +61,7 @@ installAdditionalDepend() {
DISTRO_DEPS='steam lutris goverlay' DISTRO_DEPS='steam lutris goverlay'
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS
;; ;;
apt-get|nala) apt-get | nala)
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
grep -v 'beta' | grep -v 'beta' |
tail -n1 | tail -n1 |
@ -94,8 +94,7 @@ installAdditionalDepend() {
DISTRO_DEPS='lutris' DISTRO_DEPS='lutris'
"$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS "$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS
;; ;;
*) *) ;;
;;
esac esac
} }

View File

@ -5,7 +5,7 @@
install_theme_tools() { install_theme_tools() {
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}" printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum "$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
;; ;;
zypper) zypper)
@ -47,7 +47,7 @@ applyTheming() {
configure_qt6ct() { configure_qt6ct() {
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}" printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}"
mkdir -p "$HOME/.config/qt6ct" mkdir -p "$HOME/.config/qt6ct"
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf" cat <<EOF >"$HOME/.config/qt6ct/qt6ct.conf"
[Appearance] [Appearance]
style=kvantum style=kvantum
color_scheme=default color_scheme=default
@ -58,7 +58,7 @@ EOF
# Add QT_QPA_PLATFORMTHEME to /etc/environment # Add QT_QPA_PLATFORMTHEME to /etc/environment
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}" printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}"
echo "QT_QPA_PLATFORMTHEME=qt6ct" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null echo "QT_QPA_PLATFORMTHEME=qt6ct" | "$ESCALATION_TOOL" tee -a /etc/environment >/dev/null
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}" printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}"
else else
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}" printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}"
@ -68,7 +68,7 @@ EOF
configure_kvantum() { configure_kvantum() {
printf "%b\n" "${YELLOW}Configuring Kvantum...${RC}" printf "%b\n" "${YELLOW}Configuring Kvantum...${RC}"
mkdir -p "$HOME/.config/Kvantum" mkdir -p "$HOME/.config/Kvantum"
cat <<EOF > "$HOME/.config/Kvantum/kvantum.kvconfig" cat <<EOF >"$HOME/.config/Kvantum/kvantum.kvconfig"
[General] [General]
theme=KvArcDark theme=KvArcDark
EOF EOF

View File

@ -8,13 +8,13 @@ removeSnaps() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Rns snapd "$ESCALATION_TOOL" "$PACKAGER" -Rns snapd
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" autoremove --purge snapd "$ESCALATION_TOOL" "$PACKAGER" autoremove --purge snapd
if [ "$ID" = ubuntu ]; then if [ "$ID" = ubuntu ]; then
"$ESCALATION_TOOL" apt-mark hold snapd "$ESCALATION_TOOL" apt-mark hold snapd
fi fi
;; ;;
dnf|zypper) dnf | zypper)
"$ESCALATION_TOOL" "$PACKAGER" remove snapd "$ESCALATION_TOOL" "$PACKAGER" remove snapd
;; ;;
*) *)

View File

@ -5,7 +5,7 @@
cleanup_system() { cleanup_system() {
printf "%b\n" "${YELLOW}Performing system cleanup...${RC}" printf "%b\n" "${YELLOW}Performing system cleanup...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" clean "$ESCALATION_TOOL" "$PACKAGER" clean
"$ESCALATION_TOOL" "$PACKAGER" autoremove -y "$ESCALATION_TOOL" "$PACKAGER" autoremove -y
"$ESCALATION_TOOL" du -h /var/cache/apt "$ESCALATION_TOOL" du -h /var/cache/apt
@ -21,7 +21,8 @@ cleanup_system() {
;; ;;
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm "$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1 # shellcheck disable=SC2046
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm >/dev/null 2>&1
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
@ -46,7 +47,7 @@ clean_data() {
printf "%b" "${YELLOW}Clean up old cache files and empty the trash? (y/N): ${RC}" printf "%b" "${YELLOW}Clean up old cache files and empty the trash? (y/N): ${RC}"
read -r clean_response read -r clean_response
case $clean_response in case $clean_response in
y|Y) y | Y)
printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}" printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}"
if [ -d "$HOME/.cache" ]; then if [ -d "$HOME/.cache" ]; then
find "$HOME/.cache/" -type f -atime +5 -delete find "$HOME/.cache/" -type f -atime +5 -delete

View File

@ -20,17 +20,19 @@ fastUpdate() {
dtype_local="arch" dtype_local="arch"
fi fi
"$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local} if "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root "$dtype_local" || [ ! -s /etc/pacman.d/mirrorlist ]; then
if [ $? -ne 0 ] || [ ! -s /etc/pacman.d/mirrorlist ]; then
printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}" printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist "$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
fi fi
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" apt-get update "$ESCALATION_TOOL" apt-get update
if ! command_exists nala; then if ! command_exists nala; then
"$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } "$ESCALATION_TOOL" apt-get install -y nala || {
printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"
PACKAGER="apt-get"
}
fi fi
if [ "$PACKAGER" = "nala" ]; then if [ "$PACKAGER" = "nala" ]; then
@ -49,7 +51,7 @@ fastUpdate() {
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac
@ -58,7 +60,7 @@ fastUpdate() {
updateSystem() { updateSystem() {
printf "%b\n" "${GREEN}Updating system${RC}" printf "%b\n" "${GREEN}Updating system${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y "$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;; ;;
@ -75,7 +77,7 @@ updateSystem() {
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup "$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -10,7 +10,7 @@ InstallTermiusFonts() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm terminus-font "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm terminus-font
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y fonts-terminus "$ESCALATION_TOOL" "$PACKAGER" install -y fonts-terminus
;; ;;
dnf) dnf)

View File

@ -30,10 +30,12 @@ list_sessions() {
9) session="i3.desktop" ;; 9) session="i3.desktop" ;;
10) 10)
printf "%b" "Enter custom session name (e.g., mysession): " printf "%b" "Enter custom session name (e.g., mysession): "
read -r session ;; read -r session
;;
*) *)
printf "%b\n" "Invalid option selected." printf "%b\n" "Invalid option selected."
exit 1 ;; exit 1
;;
esac esac
} }

View File

@ -58,21 +58,20 @@ update_fstab() {
fstab_entry="UUID=$UUID $mount_point $FSTYPE defaults 0 2" fstab_entry="UUID=$UUID $mount_point $FSTYPE defaults 0 2"
# Append the comment and the entry to /etc/fstab # Append the comment and the entry to /etc/fstab
printf "%b\n" "$comment" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null printf "%b\n" "$comment" | "$ESCALATION_TOOL" tee -a /etc/fstab >/dev/null
printf "%b\n" "$fstab_entry" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null printf "%b\n" "$fstab_entry" | "$ESCALATION_TOOL" tee -a /etc/fstab >/dev/null
printf "%b\n" "" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null printf "%b\n" "" | "$ESCALATION_TOOL" tee -a /etc/fstab >/dev/null
printf "%b\n" "Entry added to /etc/fstab:" printf "%b\n" "Entry added to /etc/fstab:"
printf "%b\n" "$comment" printf "%b\n" "$comment"
printf "%b\n" "$fstab_entry" printf "%b\n" "$fstab_entry"
} }
# Function to mount the drive # Function to mount the drive
mount_drive() { mount_drive() {
printf "%b\n" "Mounting the drive..." printf "%b\n" "Mounting the drive..."
"$ESCALATION_TOOL" mount -a "$ESCALATION_TOOL" mount -a
if mount | grep "$mount_point" > /dev/null; then if mount | grep "$mount_point" >/dev/null; then
printf "%b\n" "${GREEN}Drive mounted successfully at $mount_point${RC}." printf "%b\n" "${GREEN}Drive mounted successfully at $mount_point${RC}."
else else
printf "%b\n" "${RED}Failed to mount the drive.${RC}" printf "%b\n" "${RED}Failed to mount the drive.${RC}"

View File

@ -2,13 +2,12 @@
. ../common-script.sh . ../common-script.sh
# Function to check Bluez is installed
setupBluetooth() { setupBluetooth() {
printf "%b\n" "${YELLOW}Installing Bluez...${RC}" printf "%b\n" "${YELLOW}Installing Bluez...${RC}"
if ! command_exists bluetoothctl; then if ! command_exists bluetoothctl; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm bluez-utils "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm bluez-utils bluez
;; ;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y bluez "$ESCALATION_TOOL" "$PACKAGER" install -y bluez
@ -18,7 +17,6 @@ setupBluetooth() {
printf "%b\n" "${GREEN}Bluez is already installed.${RC}" printf "%b\n" "${GREEN}Bluez is already installed.${RC}"
fi fi
# Check if bluetooth service is running
if ! systemctl is-active --quiet bluetooth; then if ! systemctl is-active --quiet bluetooth; then
printf "%b\n" "${YELLOW}Bluetooth service is not running. Starting it now...${RC}" printf "%b\n" "${YELLOW}Bluetooth service is not running. Starting it now...${RC}"
"$ESCALATION_TOOL" systemctl start bluetooth "$ESCALATION_TOOL" systemctl start bluetooth
@ -29,7 +27,6 @@ setupBluetooth() {
fi fi
} }
# Function to display the main menu
main_menu() { main_menu() {
while true; do while true; do
clear clear
@ -56,7 +53,6 @@ main_menu() {
done done
} }
# Function to scan for devices
scan_devices() { scan_devices() {
clear clear
printf "%b\n" "${YELLOW}Scanning for devices...${RC}" printf "%b\n" "${YELLOW}Scanning for devices...${RC}"
@ -69,16 +65,14 @@ scan_devices() {
printf "%b\n" "$devices" printf "%b\n" "$devices"
fi fi
printf "%b" "Press any key to return to the main menu..." printf "%b" "Press any key to return to the main menu..."
read -r dummy read -r _
} }
# Function to prompt for MAC address using numbers
prompt_for_mac() { prompt_for_mac() {
action=$1 command=$1
command=$2 prompt_msg=$2
prompt_msg=$3 success_msg=$3
success_msg=$4 failure_msg=$4
failure_msg=$5
while true; do while true; do
clear clear
@ -86,7 +80,7 @@ prompt_for_mac() {
if [ -z "$devices" ]; then if [ -z "$devices" ]; then
printf "%b\n" "${RED}No devices available. Please scan for devices first.${RC}" printf "%b\n" "${RED}No devices available. Please scan for devices first.${RC}"
printf "%b" "Press any key to return to the main menu..." printf "%b" "Press any key to return to the main menu..."
read -r dummy read -r _
return return
fi fi
@ -95,23 +89,24 @@ prompt_for_mac() {
i=1 i=1
echo "$device_list" | while IFS= read -r device; do echo "$device_list" | while IFS= read -r device; do
printf "%d. %s\n" "$i" "$device" printf "%d. %s\n" "$i" "$device"
#shellcheck disable=SC2030
i=$((i + 1)) i=$((i + 1))
done done
printf "%b\n" "0. Exit to main menu" printf "%b\n" "0. Exit to main menu"
printf "%b\n" "$prompt_msg" printf "%b\n" "$prompt_msg"
read -r choice read -r choice
# Validate the choice # shellcheck disable=SC2031
if echo "$choice" | grep -qE '^[0-9]+$' && [ "$choice" -le "$((i - 1))" ] && [ "$choice" -gt 0 ]; then if echo "$choice" | grep -qE '^[0-9]+$' && [ "$choice" -le "$((i - 1))" ] && [ "$choice" -gt 0 ]; then
device=$(echo "$device_list" | sed -n "${choice}p") device=$(echo "$device_list" | sed -n "${choice}p")
mac=$(echo "$device" | awk '{print $2}') mac=$(echo "$device" | awk '{print $2}')
if bluetoothctl info "$mac" > /dev/null 2>&1; then if bluetoothctl info "$mac" >/dev/null 2>&1; then
bluetoothctl "$command" "$mac" && { if bluetoothctl "$command" "$mac"; then
printf "%b\n" "${GREEN}$success_msg${RC}" printf "%b\n" "${GREEN}$success_msg${RC}"
break break
} || { else
printf "%b\n" "${RED}$failure_msg${RC}" printf "%b\n" "${RED}$failure_msg${RC}"
} fi
else else
printf "%b\n" "${RED}Invalid MAC address. Please try again.${RC}" printf "%b\n" "${RED}Invalid MAC address. Please try again.${RC}"
fi fi
@ -122,30 +117,25 @@ prompt_for_mac() {
fi fi
done done
printf "%b" "Press any key to return to the main menu..." printf "%b" "Press any key to return to the main menu..."
read -r dummy read -r _
} }
# Function to pair with a device
pair_device() { pair_device() {
prompt_for_mac "pair" "pair" "Enter the number of the device to pair: " "Pairing with device completed." "Failed to pair with device." prompt_for_mac "pair" "Enter the number of the device to pair: " "Pairing with device completed." "Failed to pair with device."
} }
# Function to connect to a device
connect_device() { connect_device() {
prompt_for_mac "connect" "connect" "Enter the number of the device to connect: " "Connecting to device completed." "Failed to connect to device." prompt_for_mac "connect" "Enter the number of the device to connect: " "Connecting to device completed." "Failed to connect to device."
} }
# Function to disconnect from a device
disconnect_device() { disconnect_device() {
prompt_for_mac "disconnect" "disconnect" "Enter the number of the device to disconnect: " "Disconnecting from device completed." "Failed to disconnect from device." prompt_for_mac "disconnect" "Enter the number of the device to disconnect: " "Disconnecting from device completed." "Failed to disconnect from device."
} }
# Function to remove a device
remove_device() { remove_device() {
prompt_for_mac "remove" "remove" "Enter the number of the device to remove: " "Removing device completed." "Failed to remove device." prompt_for_mac "remove" "Enter the number of the device to remove: " "Removing device completed." "Failed to remove device."
} }
# Initialize
checkEnv checkEnv
checkEscalationTool checkEscalationTool
setupBluetooth setupBluetooth

View File

@ -4,7 +4,6 @@
CONFIGURATION_URL="https://github.com/quickemu-project/quickget_configs/releases/download/daily/quickget_data.json" CONFIGURATION_URL="https://github.com/quickemu-project/quickget_configs/releases/download/daily/quickget_data.json"
# Function to display all available block devices
list_devices() { list_devices() {
printf "%b\n" "${YELLOW} Available devices and partitions: ${RC}" printf "%b\n" "${YELLOW} Available devices and partitions: ${RC}"
printf "\n" printf "\n"
@ -12,17 +11,21 @@ list_devices() {
printf "\n" printf "\n"
} }
# shellcheck disable=SC2086
installDependencies() { installDependencies() {
DEPENDENCIES="xz gzip bzip2 jq" DEPENDENCIES="xz gzip bzip2 jq"
if ! command_exists ${DEPENDENCIES}; then if ! command_exists ${DEPENDENCIES}; then
printf "%b\n" "${YELLOW}Installing dependencies...${RC}" printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "${PACKAGER}" in case "${PACKAGER}" in
apt-get|nala) apt-get | nala)
"${ESCALATION_TOOL}" "${PACKAGER}" install -y xz-utils gzip bzip2 jq;; "${ESCALATION_TOOL}" "${PACKAGER}" install -y xz-utils gzip bzip2 jq
dnf|zypper) ;;
"${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES};; dnf | zypper)
"${ESCALATION_TOOL}" "${PACKAGER}" install -y ${DEPENDENCIES}
;;
pacman) pacman)
"${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES};; "${ESCALATION_TOOL}" "${PACKAGER}" -S --noconfirm --needed ${DEPENDENCIES}
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager.${RC}" printf "%b\n" "${RED}Unsupported package manager.${RC}"
exit 1 exit 1
@ -31,7 +34,6 @@ installDependencies() {
fi fi
} }
# Function to ask whether to use local or online ISO
choose_iso_source() { choose_iso_source() {
printf "%b\n" "${YELLOW} Do you want to use a local ISO or download online? ${RC}" printf "%b\n" "${YELLOW} Do you want to use a local ISO or download online? ${RC}"
printf "1) Download online\n" printf "1) Download online\n"
@ -64,13 +66,16 @@ decompress_iso() {
case "${ISO_ARCHIVE_FORMAT}" in case "${ISO_ARCHIVE_FORMAT}" in
xz) xz)
xz -d "${ISO_PATH}" xz -d "${ISO_PATH}"
ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.xz//')";; ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.xz//')"
;;
gz) gz)
gzip -d "${ISO_PATH}" gzip -d "${ISO_PATH}"
ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.gz//')";; ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.gz//')"
;;
bz2) bz2)
bzip2 -d "${ISO_PATH}" bzip2 -d "${ISO_PATH}"
ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.bz2//')";; ISO_PATH="$(echo "${ISO_PATH}" | sed 's/\.bz2//')"
;;
*) *)
printf "%b\n" "${RED}Unsupported archive format. Try manually decompressing the ISO and choosing it as a local file instead.${RC}" printf "%b\n" "${RED}Unsupported archive format. Try manually decompressing the ISO and choosing it as a local file instead.${RC}"
exit 1 exit 1
@ -82,12 +87,14 @@ decompress_iso() {
check_hash() { check_hash() {
case "${#ISO_CHECKSUM}" in case "${#ISO_CHECKSUM}" in
32) HASH_ALGO="md5sum";; 32) HASH_ALGO="md5sum" ;;
40) HASH_ALGO="sha1sum";; 40) HASH_ALGO="sha1sum" ;;
64) HASH_ALGO="sha256sum";; 64) HASH_ALGO="sha256sum" ;;
128) HASH_ALGO="sha512sum";; 128) HASH_ALGO="sha512sum" ;;
*) printf "%b\n" "${RED}Invalid checksum length. Skipping checksum verification.${RC}" *)
return;; printf "%b\n" "${RED}Invalid checksum length. Skipping checksum verification.${RC}"
return
;;
esac esac
printf "%b\n" "Checking ISO integrity using ${HASH_ALGO}..." printf "%b\n" "Checking ISO integrity using ${HASH_ALGO}..."
if ! echo "${ISO_CHECKSUM} ${ISO_PATH}" | "${HASH_ALGO}" --check --status; then if ! echo "${ISO_CHECKSUM} ${ISO_PATH}" | "${HASH_ALGO}" --check --status; then
@ -115,9 +122,9 @@ get_architecture() {
printf "%b" "Select an option (1-3): " printf "%b" "Select an option (1-3): "
read -r ARCH read -r ARCH
case "${ARCH}" in case "${ARCH}" in
1) ARCH="x86_64";; 1) ARCH="x86_64" ;;
2) ARCH="aarch64";; 2) ARCH="aarch64" ;;
3) ARCH="riscv64";; 3) ARCH="riscv64" ;;
*) *)
printf "%b\n" "${RED}Invalid architecture selected. ${RC}" printf "%b\n" "${RED}Invalid architecture selected. ${RC}"
exit 1 exit 1
@ -209,27 +216,21 @@ get_online_iso() {
fi fi
} }
write_iso(){ write_iso() {
clear clear
# Ask whether to use a local or online ISO
choose_iso_source choose_iso_source
clear clear
# Display all available devices
list_devices list_devices
# Prompt user for USB device
printf "%b" "Enter the USB device (e.g. /dev/sdX): " printf "%b" "Enter the USB device (e.g. /dev/sdX): "
read -r USB_DEVICE read -r USB_DEVICE
# Verify that the USB device exists
if [ ! -b "$USB_DEVICE" ]; then if [ ! -b "$USB_DEVICE" ]; then
printf "%b\n" "${RED}USB device not found: $USB_DEVICE${RC}" printf "%b\n" "${RED}USB device not found: $USB_DEVICE${RC}"
exit 1 exit 1
fi fi
# Confirm the device selection with the user
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}" printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
read -r CONFIRMATION read -r CONFIRMATION
@ -238,14 +239,12 @@ write_iso(){
exit 1 exit 1
fi fi
# Display progress and create the bootable USB drive
printf "%b\n" "${YELLOW}Creating bootable USB drive...${RC}" printf "%b\n" "${YELLOW}Creating bootable USB drive...${RC}"
if ! "$ESCALATION_TOOL" dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then if ! "$ESCALATION_TOOL" dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then
printf "%b\n" "${RED}Failed to create bootable USB drive${RC}" printf "%b\n" "${RED}Failed to create bootable USB drive${RC}"
exit 1 exit 1
fi fi
# Sync to ensure all data is written
if ! "$ESCALATION_TOOL" sync; then if ! "$ESCALATION_TOOL" sync; then
printf "%b\n" "${RED}Failed to sync data${RC}" printf "%b\n" "${RED}Failed to sync data${RC}"
exit 1 exit 1
@ -253,7 +252,6 @@ write_iso(){
printf "%b\n" "${GREEN}Bootable USB drive created successfully!${RC}" printf "%b\n" "${GREEN}Bootable USB drive created successfully!${RC}"
# Eject the USB device
printf "%b\n" "${YELLOW}Ejecting ${USB_DEVICE}...${RC}" printf "%b\n" "${YELLOW}Ejecting ${USB_DEVICE}...${RC}"
if ! "$ESCALATION_TOOL" umount "${USB_DEVICE}"* 2>/dev/null; then if ! "$ESCALATION_TOOL" umount "${USB_DEVICE}"* 2>/dev/null; then
printf "%b\n" "${RED}Failed to unmount ${USB_DEVICE}${RC}" printf "%b\n" "${RED}Failed to unmount ${USB_DEVICE}${RC}"

View File

@ -1,16 +1,17 @@
#!/bin/sh -e #!/bin/sh -e
# shellcheck disable=SC2181
. ../common-script.sh . ../common-script.sh
# Function to display the menu
printf "%b\n" "${YELLOW}Ensuring OpenSSL is installed...${RC}" printf "%b\n" "${YELLOW}Ensuring OpenSSL is installed...${RC}"
# Install OpenSSL
if ! command_exists openssl; then if ! command_exists openssl; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed openssl "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm --needed openssl
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y openssl "$ESCALATION_TOOL" "$PACKAGER" install -y openssl
;; ;;
dnf) dnf)
@ -40,7 +41,6 @@ show_menu() {
printf "%b\n" "========================================================" printf "%b\n" "========================================================"
} }
# Function to encrypt a file
encrypt_file() { encrypt_file() {
printf "%b" "Enter the path to the file or directory to encrypt: " printf "%b" "Enter the path to the file or directory to encrypt: "
read -r INPUT_PATH read -r INPUT_PATH
@ -59,15 +59,12 @@ encrypt_file() {
if [ -d "$INPUT_PATH" ]; then if [ -d "$INPUT_PATH" ]; then
# Encrypt each file in the directory # Encrypt each file in the directory
find "$INPUT_PATH" -type f | while read -r FILE; do find "$INPUT_PATH" -type f | while read -r FILE; do
REL_PATH="${FILE#$INPUT_PATH/}" REL_PATH="${FILE#"$INPUT_PATH"/}"
OUTPUT_FILE="$OUTPUT_PATH/$REL_PATH.enc" OUTPUT_FILE="$OUTPUT_PATH/$REL_PATH.enc"
mkdir -p "$(dirname "$OUTPUT_FILE")" mkdir -p "$(dirname "$OUTPUT_FILE")"
openssl enc -aes-256-cbc -salt -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD" openssl enc -aes-256-cbc -salt -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD"
if [ $? -eq 0 ]; then
printf "%b\n" "Encrypted: $OUTPUT_FILE" printf "%b\n" "Encrypted: $OUTPUT_FILE"
else
printf "%b\n" "Failed to encrypt: $FILE"
fi
done done
else else
# Encrypt a single file # Encrypt a single file
@ -77,15 +74,11 @@ encrypt_file() {
fi fi
mkdir -p "$(dirname "$OUTPUT_PATH")" mkdir -p "$(dirname "$OUTPUT_PATH")"
openssl enc -aes-256-cbc -salt -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD" openssl enc -aes-256-cbc -salt -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD"
if [ $? -eq 0 ]; then
printf "%b\n" "Encrypted: $OUTPUT_PATH" printf "%b\n" "Encrypted: $OUTPUT_PATH"
else
printf "%b\n" "Failed to encrypt: $INPUT_PATH"
fi
fi fi
} }
# Function to decrypt a file
decrypt_file() { decrypt_file() {
printf "%b" "Enter the path to the file or directory to decrypt: " printf "%b" "Enter the path to the file or directory to decrypt: "
read -r INPUT_PATH read -r INPUT_PATH
@ -104,15 +97,12 @@ decrypt_file() {
if [ -d "$INPUT_PATH" ]; then if [ -d "$INPUT_PATH" ]; then
# Decrypt each file in the directory # Decrypt each file in the directory
find "$INPUT_PATH" -type f -name '*.enc' | while read -r FILE; do find "$INPUT_PATH" -type f -name '*.enc' | while read -r FILE; do
REL_PATH="${FILE#$INPUT_PATH/}" REL_PATH="${FILE#"$INPUT_PATH"/}"
OUTPUT_FILE="$OUTPUT_PATH/${REL_PATH%.enc}" OUTPUT_FILE="$OUTPUT_PATH/${REL_PATH%.enc}"
mkdir -p "$(dirname "$OUTPUT_FILE")" mkdir -p "$(dirname "$OUTPUT_FILE")"
openssl enc -aes-256-cbc -d -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD" openssl enc -aes-256-cbc -d -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD"
if [ $? -eq 0 ]; then
printf "%b\n" "Decrypted: $OUTPUT_FILE" printf "%b\n" "Decrypted: $OUTPUT_FILE"
else
printf "%b\n" "Failed to decrypt: $FILE"
fi
done done
else else
# Decrypt a single file # Decrypt a single file
@ -122,15 +112,12 @@ decrypt_file() {
fi fi
mkdir -p "$(dirname "$OUTPUT_PATH")" mkdir -p "$(dirname "$OUTPUT_PATH")"
openssl enc -aes-256-cbc -d -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD" openssl enc -aes-256-cbc -d -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD"
if [ $? -eq 0 ]; then
printf "%b\n" "Decrypted: $OUTPUT_PATH" printf "%b\n" "Decrypted: $OUTPUT_PATH"
else
printf "%b\n" "Failed to decrypt: $INPUT_PATH"
fi
fi fi
} }
main(){ main() {
clear clear
while true; do while true; do
show_menu show_menu
@ -140,12 +127,15 @@ main(){
case $CHOICE in case $CHOICE in
1) encrypt_file ;; 1) encrypt_file ;;
2) decrypt_file ;; 2) decrypt_file ;;
3) printf "%b\n" "Exiting..."; exit 0 ;; 3)
printf "%b\n" "Exiting..."
exit 0
;;
*) printf "%b\n" "Invalid choice. Please try again." ;; *) printf "%b\n" "Invalid choice. Please try again." ;;
esac esac
printf "%b\n" "Press [Enter] to continue..." printf "%b\n" "Press [Enter] to continue..."
read -r dummy read -r _
done done
} }

View File

@ -18,8 +18,8 @@ auto_detect_displays() {
temp_common_resolutions=$(mktemp) temp_common_resolutions=$(mktemp)
temp_resolutions=$(mktemp) temp_resolutions=$(mktemp)
printf "%b\n" "$common_resolutions" > "$temp_common_resolutions" printf "%b\n" "$common_resolutions" >"$temp_common_resolutions"
printf "%b\n" "$resolutions" > "$temp_resolutions" printf "%b\n" "$resolutions" >"$temp_resolutions"
common_resolutions=$(comm -12 "$temp_common_resolutions" "$temp_resolutions") common_resolutions=$(comm -12 "$temp_common_resolutions" "$temp_resolutions")

View File

@ -47,7 +47,10 @@ change_orientation() {
2) orientation="left" ;; 2) orientation="left" ;;
3) orientation="right" ;; 3) orientation="right" ;;
4) orientation="inverted" ;; 4) orientation="inverted" ;;
*) printf "%b\n" "${RED}Invalid selection.${RC}"; return ;; *)
printf "%b\n" "${RED}Invalid selection.${RC}"
return
;;
esac esac
if confirm_action "Change orientation of $monitor_name to $orientation?"; then if confirm_action "Change orientation of $monitor_name to $orientation?"; then

View File

@ -11,7 +11,7 @@ extend_displays() {
i=1 i=1
for monitor in $monitor_array; do for monitor in $monitor_array; do
if [ "$i" -gt 1 ]; then if [ "$i" -gt 1 ]; then
prev_monitor=$(echo "$monitor_array" | cut -d' ' -f$((i-1))) prev_monitor=$(echo "$monitor_array" | cut -d' ' -f$((i - 1)))
if confirm_action "Extend $monitor to the right of $prev_monitor?"; then if confirm_action "Extend $monitor to the right of $prev_monitor?"; then
printf "%b\n" "${GREEN}Extending $monitor to the right of $prev_monitor${RC}" printf "%b\n" "${GREEN}Extending $monitor to the right of $prev_monitor${RC}"
execute_command "xrandr --output $monitor --right-of $prev_monitor" execute_command "xrandr --output $monitor --right-of $prev_monitor"

View File

@ -45,7 +45,10 @@ manage_arrangement() {
2) position="--right-of" ;; 2) position="--right-of" ;;
3) position="--above" ;; 3) position="--above" ;;
4) position="--below" ;; 4) position="--below" ;;
*) printf "%b\n" "${RED}Invalid selection.${RC}"; return ;; *)
printf "%b\n" "${RED}Invalid selection.${RC}"
return
;;
esac esac
printf "%b\n" "${YELLOW}Choose the reference monitor:${RC}" printf "%b\n" "${YELLOW}Choose the reference monitor:${RC}"

View File

@ -29,7 +29,7 @@ adjust_monitor_brightness() {
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}" printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "Press [Enter] to continue..." printf "Press [Enter] to continue..."
read -r dummy read -r _
continue continue
fi fi
@ -37,7 +37,7 @@ adjust_monitor_brightness() {
if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$monitor_count" ]; then if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$monitor_count" ]; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}" printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "Press [Enter] to continue..." printf "Press [Enter] to continue..."
read -r dummy read -r _
continue continue
fi fi

View File

@ -4,7 +4,6 @@
. ../../common-script.sh . ../../common-script.sh
# Function to set resolutions
set_resolutions() { set_resolutions() {
monitor_list=$(detect_connected_monitors) monitor_list=$(detect_connected_monitors)
monitor_array=$(echo "$monitor_list" | tr '\n' ' ') monitor_array=$(echo "$monitor_list" | tr '\n' ' ')
@ -33,7 +32,7 @@ set_resolutions() {
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$' || [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$((i - 1))" ]; then if ! echo "$monitor_choice" | grep -qE '^[0-9]+$' || [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$((i - 1))" ]; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}" printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "%b\n" "Press [Enter] to continue..." printf "%b\n" "Press [Enter] to continue..."
read -r dummy read -r _
continue continue
fi fi
@ -41,13 +40,13 @@ set_resolutions() {
resolutions=$(get_unique_resolutions "$monitor_name" | sort -rn -t'x' -k1,1 -k2,2) resolutions=$(get_unique_resolutions "$monitor_name" | sort -rn -t'x' -k1,1 -k2,2)
temp_res_file=$(mktemp) temp_res_file=$(mktemp)
printf "%b\n" "$resolutions" | awk '{print NR " " $0}' > "$temp_res_file" printf "%b\n" "$resolutions" | awk '{print NR " " $0}' >"$temp_res_file"
i=1 i=1
while read -r resolution; do while read -r resolution; do
echo "$resolution" >> "$temp_res_file" echo "$resolution" >>"$temp_res_file"
i=$((i + 1)) i=$((i + 1))
done < "$temp_res_file" done <"$temp_res_file"
clear clear
printf "%b\n" "${YELLOW}=========================================${RC}" printf "%b\n" "${YELLOW}=========================================${RC}"

View File

@ -39,7 +39,6 @@ EOF
} }
numlockSetup() { numlockSetup() {
# Check if the script and service files exists
if [ ! -f "/usr/local/bin/numlock" ]; then if [ ! -f "/usr/local/bin/numlock" ]; then
create_file create_file
fi fi

View File

@ -52,27 +52,26 @@ display_models() {
printf "%b\n" "16. Solar - 10.7B (6.1GB)" printf "%b\n" "16. Solar - 10.7B (6.1GB)"
} }
# Function to select model based on user input
select_model() { select_model() {
choice="$1" choice="$1"
case $choice in case $choice in
1) printf "%b\n" "llama3.1";; 1) printf "%b\n" "llama3.1" ;;
2) printf "%b\n" "llama3.1:70b";; 2) printf "%b\n" "llama3.1:70b" ;;
3) printf "%b\n" "llama3.1:405b";; 3) printf "%b\n" "llama3.1:405b" ;;
4) printf "%b\n" "phi3";; 4) printf "%b\n" "phi3" ;;
5) printf "%b\n" "phi3:medium";; 5) printf "%b\n" "phi3:medium" ;;
6) printf "%b\n" "gemma2:2b";; 6) printf "%b\n" "gemma2:2b" ;;
7) printf "%b\n" "gemma2";; 7) printf "%b\n" "gemma2" ;;
8) printf "%b\n" "gemma2:27b";; 8) printf "%b\n" "gemma2:27b" ;;
9) printf "%b\n" "mistral";; 9) printf "%b\n" "mistral" ;;
10) printf "%b\n" "moondream";; 10) printf "%b\n" "moondream" ;;
11) printf "%b\n" "neural-chat";; 11) printf "%b\n" "neural-chat" ;;
12) printf "%b\n" "starling-lm";; 12) printf "%b\n" "starling-lm" ;;
13) printf "%b\n" "codellama";; 13) printf "%b\n" "codellama" ;;
14) printf "%b\n" "llama2-uncensored";; 14) printf "%b\n" "llama2-uncensored" ;;
15) printf "%b\n" "llava";; 15) printf "%b\n" "llava" ;;
16) printf "%b\n" "solar";; 16) printf "%b\n" "solar" ;;
*) printf "%b\n" "$choice";; *) printf "%b\n" "$choice" ;;
esac esac
} }
@ -82,10 +81,11 @@ run_model() {
printf "%b\n" "${GREEN}Installed Models${RC}" printf "%b\n" "${GREEN}Installed Models${RC}"
installed_models=$(ollama list) installed_models=$(ollama list)
printf "%b\n" "${installed_models}" printf "%b\n" "$installed_models"
printf "%b\n" "${YELLOW}Custom Models${RC}" printf "%b\n" "${YELLOW}Custom Models${RC}"
custom_models=$(ollama list | grep 'custom-model-prefix') custom_models=$(ollama list | grep 'custom-model-prefix')
printf "%b\n" "$custom_models"
printf "%b" "Select a model to run: " printf "%b" "Select a model to run: "
printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: " printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: "
@ -103,7 +103,6 @@ create_model() {
printf "%b\n" "${YELLOW}Let's create a new model in Ollama!${RC}" printf "%b\n" "${YELLOW}Let's create a new model in Ollama!${RC}"
display_models display_models
# Prompt for base model
printf "%b" "Enter the base model (e.g. '13' for codellama): " printf "%b" "Enter the base model (e.g. '13' for codellama): "
read -r base_model read -r base_model
@ -112,11 +111,9 @@ create_model() {
printf "%b\n" "${YELLOW}Running the model: $model...${RC}" printf "%b\n" "${YELLOW}Running the model: $model...${RC}"
ollama pull "$model" ollama pull "$model"
# Prompt for custom model name
printf "%b" "Enter a name for the new customized model: " printf "%b" "Enter a name for the new customized model: "
read -r custom_model_name read -r custom_model_name
# Prompt for temperature setting
printf "%b" "Enter the desired temperature (higher values are more creative, lower values are more coherent, e.g., 1): " printf "%b" "Enter the desired temperature (higher values are more creative, lower values are more coherent, e.g., 1): "
read -r temperature read -r temperature
@ -124,13 +121,11 @@ create_model() {
temperature=${temperature:-1} temperature=${temperature:-1}
fi fi
# Prompt for system message
printf "%b" "Enter the system message for the model customization (e.g., 'You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.'): " printf "%b" "Enter the system message for the model customization (e.g., 'You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.'): "
read -r system_message read -r system_message
# Create the Modelfile
printf "%b\n" "${YELLOW}Creating the Modelfile...${RC}" printf "%b\n" "${YELLOW}Creating the Modelfile...${RC}"
cat << EOF > Modelfile cat <<EOF >Modelfile
FROM $base_model FROM $base_model
# set the temperature to $temperature # set the temperature to $temperature
@ -142,13 +137,11 @@ $system_message
""" """
EOF EOF
# Create the model in Ollama
printf "%b\n" "${YELLOW}Creating the model in Ollama...${RC}" printf "%b\n" "${YELLOW}Creating the model in Ollama...${RC}"
ollama create "$custom_model_name" -f Modelfile ollama create "$custom_model_name" -f Modelfile
printf "%b\n" "${GREEN}Model '$custom_model_name' created successfully.${RC}" printf "%b\n" "${GREEN}Model '$custom_model_name' created successfully.${RC}"
} }
# Function to remove a model
remove_model() { remove_model() {
clear clear
printf "%b\n" "${GREEN}Installed Models${RC}" printf "%b\n" "${GREEN}Installed Models${RC}"
@ -189,13 +182,16 @@ menu() {
2) show_model_info ;; 2) show_model_info ;;
3) create_model ;; 3) create_model ;;
4) run_model ;; 4) run_model ;;
5) remove_model;; 5) remove_model ;;
6) printf "%b\n" "${GREEN}Exiting...${RC}"; exit 0 ;; 6)
printf "%b\n" "${GREEN}Exiting...${RC}"
exit 0
;;
*) printf "%b\n" "${RED}Invalid choice. Please try again.${RC}" ;; *) printf "%b\n" "${RED}Invalid choice. Please try again.${RC}" ;;
esac esac
printf "%b\n" "${YELLOW}Press Enter to continue...${RC}" printf "%b\n" "${YELLOW}Press Enter to continue...${RC}"
read -r dummy read -r _
done done
} }
@ -203,4 +199,3 @@ checkEnv
checkEscalationTool checkEscalationTool
installollama installollama
menu menu

View File

@ -5,18 +5,18 @@
# Function to install packages based on the package manager # Function to install packages based on the package manager
install_package() { install_package() {
PACKAGE=$1 package=$1
if ! command_exists "$PACKAGE"; then if ! command_exists "$package"; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$PACKAGE" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$package"
;; ;;
*) *)
"$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE" "$ESCALATION_TOOL" "$PACKAGER" install -y "$package"
;; ;;
esac esac
else else
echo "$PACKAGE is already installed." echo "$package is already installed."
fi fi
} }
@ -26,7 +26,7 @@ setup_ssh() {
# Detect package manager and install appropriate SSH package # Detect package manager and install appropriate SSH package
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get | nala)
install_package openssh-server install_package openssh-server
SSH_SERVICE="ssh" SSH_SERVICE="ssh"
;; ;;
@ -112,7 +112,7 @@ setup_samba() {
"$ESCALATION_TOOL" smbpasswd -a "$SAMBA_USER" "$ESCALATION_TOOL" smbpasswd -a "$SAMBA_USER"
# Configure Samba settings # Configure Samba settings
"$ESCALATION_TOOL" tee "$SAMBA_CONFIG" > /dev/null <<EOL "$ESCALATION_TOOL" tee "$SAMBA_CONFIG" >/dev/null <<EOL
[global] [global]
workgroup = WORKGROUP workgroup = WORKGROUP
server string = Samba Server server string = Samba Server
@ -157,7 +157,7 @@ configure_firewall() {
fi fi
} }
setup_ssh_samba(){ setup_ssh_samba() {
printf "%b\n" "Samba and SSH Setup Script" printf "%b\n" "Samba and SSH Setup Script"
printf "%b\n" "--------------------------" printf "%b\n" "--------------------------"
clear clear
@ -171,7 +171,7 @@ setup_ssh_samba(){
printf "%b\n" "5. Exit" printf "%b\n" "5. Exit"
printf "%b" "Enter your choice (1-5): " printf "%b" "Enter your choice (1-5): "
read CHOICE read -r CHOICE
case "$CHOICE" in case "$CHOICE" in
1) 1)

View File

@ -92,7 +92,7 @@ add_service() {
printf "\n" printf "\n"
printf "%b\n" "[Install]" printf "%b\n" "[Install]"
printf "%b\n" "WantedBy=multi-user.target" printf "%b\n" "WantedBy=multi-user.target"
} | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null } | "$ESCALATION_TOOL" tee "$SERVICE_FILE" >/dev/null
# Set permissions and reload systemd # Set permissions and reload systemd
"$ESCALATION_TOOL" chmod 644 "$SERVICE_FILE" "$ESCALATION_TOOL" chmod 644 "$SERVICE_FILE"
@ -262,12 +262,15 @@ main() {
8) enable_service ;; 8) enable_service ;;
9) disable_service ;; 9) disable_service ;;
10) create_service_from_external ;; 10) create_service_from_external ;;
11) printf "%b\n" "Exiting..."; exit 0 ;; 11)
printf "%b\n" "Exiting..."
exit 0
;;
*) printf "%b\n" "Invalid choice. Please try again." ;; *) printf "%b\n" "Invalid choice. Please try again." ;;
esac esac
printf "%b\n" "Press [Enter] to continue..." printf "%b\n" "Press [Enter] to continue..."
read -r dummy read -r _
done done
} }

View File

@ -2,21 +2,18 @@
. ../common-script.sh . ../common-script.sh
# Check if ~/.ssh/config exists, if not, create it
if [ ! -f ~/.ssh/config ]; then if [ ! -f ~/.ssh/config ]; then
mkdir -p "$HOME/.ssh" mkdir -p "$HOME/.ssh"
touch "$HOME/.ssh/config" touch "$HOME/.ssh/config"
chmod 600 "$HOME/.ssh/config" chmod 600 "$HOME/.ssh/config"
fi fi
# Function to show available hosts from ~/.ssh/config
show_available_hosts() { show_available_hosts() {
printf "%b\n" "Available Systems:" printf "%b\n" "Available Systems:"
grep -E "^Host " "$HOME/.ssh/config" | awk '{print $2}' grep -E "^Host " "$HOME/.ssh/config" | awk '{print $2}'
printf "%b\n" "-------------------" printf "%b\n" "-------------------"
} }
# Function to ask for host details
ask_for_host_details() { ask_for_host_details() {
printf "%b" "Enter Host Alias: " printf "%b" "Enter Host Alias: "
read -r host_alias read -r host_alias
@ -31,11 +28,10 @@ ask_for_host_details() {
printf "%b\n" " IdentityFile ~/.ssh/id_rsa" printf "%b\n" " IdentityFile ~/.ssh/id_rsa"
printf "%b\n" " StrictHostKeyChecking no" printf "%b\n" " StrictHostKeyChecking no"
printf "%b\n" " UserKnownHostsFile=/dev/null" printf "%b\n" " UserKnownHostsFile=/dev/null"
} >> ~/.ssh/config } >>~/.ssh/config
printf "%b\n" "Host $host_alias added successfully." printf "%b\n" "Host $host_alias added successfully."
} }
# Function to generate SSH key if not exists
generate_ssh_key() { generate_ssh_key() {
if [ ! -f ~/.ssh/id_rsa ]; then if [ ! -f ~/.ssh/id_rsa ]; then
printf "%b\n" "SSH key not found, generating one..." printf "%b\n" "SSH key not found, generating one..."
@ -45,7 +41,6 @@ generate_ssh_key() {
fi fi
} }
# Function to share the SSH public key with the remote host
share_ssh_key() { share_ssh_key() {
printf "%b" "Enter the alias of the host to copy the key to: " printf "%b" "Enter the alias of the host to copy the key to: "
read -r host_alias read -r host_alias
@ -54,19 +49,18 @@ share_ssh_key() {
printf "%b\n" "SSH key copied to $host_alias successfully." printf "%b\n" "SSH key copied to $host_alias successfully."
} }
# Function to disable password authentication and allow only SSH keys
#repeated twice as changes should take place when in commented state or modified state.
disable_password_auth() { disable_password_auth() {
printf "%b\n" "Disabling SSH password authentication and enabling key-only login..." printf "%b\n" "Disabling SSH password authentication and enabling key-only login..."
printf "%b\n" "Enter the alias of the host: " printf "%b\n" "Enter the alias of the host: "
read -r host_alias read -r host_alias
printf "\n" printf "\n"
# shellcheck disable=SC2029
ssh "$host_alias" " ssh "$host_alias" "
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S systemctl restart sshd $ESCALATION_TOOL -S systemctl restart sshd
" "
printf "%b\n" "PasswordAuthentication set to no and PubkeyAuthentication set to yes." printf "%b\n" "PasswordAuthentication set to no and PubkeyAuthentication set to yes."
} }
@ -76,12 +70,13 @@ enable_password_auth() {
printf "%b\n" "Enter the alias of the host: " printf "%b\n" "Enter the alias of the host: "
read -r host_alias read -r host_alias
printf "\n" printf "\n"
# shellcheck disable=SC2029
ssh "$host_alias" " ssh "$host_alias" "
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && $ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S systemctl restart sshd $ESCALATION_TOOL -S systemctl restart sshd
" "
printf "%b\n" "PasswordAuthentication set to yes and PubkeyAuthentication set to no." printf "%b\n" "PasswordAuthentication set to yes and PubkeyAuthentication set to no."
} }
@ -99,6 +94,7 @@ run_remote_command() {
read -r host_alias read -r host_alias
printf "%b" "Enter the command to run: " printf "%b" "Enter the command to run: "
read -r remote_command read -r remote_command
# shellcheck disable=SC2029
ssh "$host_alias" "$remote_command" ssh "$host_alias" "$remote_command"
} }
@ -124,7 +120,6 @@ copy_directory_to_remote() {
scp -r "$local_dir" "$host_alias:$remote_path" scp -r "$local_dir" "$host_alias:$remote_path"
} }
# Function to move a file to a remote server (copy and delete local) # Function to move a file to a remote server (copy and delete local)
move_file_to_remote() { move_file_to_remote() {
printf "%b" "Enter the local file path: " printf "%b" "Enter the local file path: "
@ -226,7 +221,10 @@ main() {
read -r choice read -r choice
case $choice in case $choice in
1) ask_for_host_details ;; 1) ask_for_host_details ;;
2) show_available_hosts && printf "%b" "Enter the alias of the host to connect to: " && read -r host_alias; ssh "$host_alias" ;; 2)
show_available_hosts && printf "%b" "Enter the alias of the host to connect to: " && read -r host_alias
ssh "$host_alias"
;;
3) generate_ssh_key ;; 3) generate_ssh_key ;;
4) share_ssh_key ;; 4) share_ssh_key ;;
5) disable_password_auth ;; 5) disable_password_auth ;;
@ -245,7 +243,7 @@ main() {
18) exit ;; 18) exit ;;
*) printf "%b\n" "Invalid choice. Please try again." ;; *) printf "%b\n" "Invalid choice. Please try again." ;;
esac esac
done done
} }
checkEnv checkEnv

View File

@ -2,7 +2,6 @@
. ../common-script.sh . ../common-script.sh
# Function to install Timeshift
install_timeshift() { install_timeshift() {
clear clear
printf "%b\n" "${YELLOW}Checking if Timeshift is installed...${RC}" printf "%b\n" "${YELLOW}Checking if Timeshift is installed...${RC}"
@ -21,7 +20,6 @@ install_timeshift() {
fi fi
} }
# Function to display the menu
display_menu() { display_menu() {
clear clear
printf "%b\n" "${CYAN}Timeshift CLI Automation${RC}" printf "%b\n" "${CYAN}Timeshift CLI Automation${RC}"
@ -34,19 +32,16 @@ display_menu() {
printf "%b\n" "${CYAN}7) Exit${RC}" printf "%b\n" "${CYAN}7) Exit${RC}"
} }
# Function to list snapshots
list_snapshots() { list_snapshots() {
printf "%b\n" "${CYAN}Listing snapshots...${RC}" printf "%b\n" "${CYAN}Listing snapshots...${RC}"
"$ESCALATION_TOOL" timeshift --list-snapshots "$ESCALATION_TOOL" timeshift --list-snapshots
} }
# Function to list devices
list_devices() { list_devices() {
printf "%b\n" "${CYAN}Listing available devices...${RC}" printf "%b\n" "${CYAN}Listing available devices...${RC}"
"$ESCALATION_TOOL" timeshift --list-devices "$ESCALATION_TOOL" timeshift --list-devices
} }
# Function to create a new snapshot
create_snapshot() { create_snapshot() {
printf "%b" "${CYAN}Enter a comment for the snapshot (optional): ${RC}" printf "%b" "${CYAN}Enter a comment for the snapshot (optional): ${RC}"
read -r COMMENT read -r COMMENT
@ -64,14 +59,9 @@ create_snapshot() {
"$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG" "$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG"
fi fi
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}Snapshot created successfully.${RC}" printf "%b\n" "${GREEN}Snapshot created successfully.${RC}"
else
printf "%b\n" "${RED}Snapshot creation failed.${RC}"
fi
} }
# Function to restore a snapshot
restore_snapshot() { restore_snapshot() {
list_snapshots list_snapshots
@ -90,14 +80,9 @@ restore_snapshot() {
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes "$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes
fi fi
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}Snapshot restored successfully.${RC}" printf "%b\n" "${GREEN}Snapshot restored successfully.${RC}"
else
printf "%b\n" "${RED}Snapshot restore failed.${RC}"
fi
} }
# Function to delete a snapshot
delete_snapshot() { delete_snapshot() {
list_snapshots list_snapshots
@ -107,14 +92,9 @@ delete_snapshot() {
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}" printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
"$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes "$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}" printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}"
else
printf "%b\n" "${RED}Snapshot deletion failed.${RC}"
fi
} }
# Function to delete all snapshots
delete_all_snapshots() { delete_all_snapshots() {
printf "%b\n" "${RED}WARNING: This will delete all snapshots!${RC}" printf "%b\n" "${RED}WARNING: This will delete all snapshots!${RC}"
printf "%b" "${CYAN}Are you sure? (y/N): ${RC}" printf "%b" "${CYAN}Are you sure? (y/N): ${RC}"
@ -123,11 +103,7 @@ delete_all_snapshots() {
if [ "$CONFIRMATION" = "y" ] || [ "$CONFIRMATION" = "Y" ]; then if [ "$CONFIRMATION" = "y" ] || [ "$CONFIRMATION" = "Y" ]; then
printf "%b\n" "${CYAN}Deleting all snapshots...${RC}" printf "%b\n" "${CYAN}Deleting all snapshots...${RC}"
"$ESCALATION_TOOL" timeshift --delete-all --yes "$ESCALATION_TOOL" timeshift --delete-all --yes
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}" printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}"
else
printf "%b\n" "${RED}Failed to delete snapshots.${RC}"
fi
else else
printf "%b\n" "${RED}Operation cancelled.${RC}" printf "%b\n" "${RED}Operation cancelled.${RC}"
fi fi
@ -146,11 +122,14 @@ main_menu() {
4) restore_snapshot ;; 4) restore_snapshot ;;
5) delete_snapshot ;; 5) delete_snapshot ;;
6) delete_all_snapshots ;; 6) delete_all_snapshots ;;
7) printf "%b\n" "${GREEN}Exiting...${RC}"; exit 0 ;; 7)
printf "%b\n" "${GREEN}Exiting...${RC}"
exit 0
;;
*) printf "%b\n" "${RED}Invalid option. Please try again.${RC}" ;; *) printf "%b\n" "${RED}Invalid option. Please try again.${RC}" ;;
esac esac
printf "%b\n" "${CYAN}Press Enter to continue...${RC}" printf "%b\n" "${CYAN}Press Enter to continue...${RC}"
read -r dummy read -r _
done done
} }

View File

@ -33,7 +33,7 @@ addToGroup() {
groups_to_add=$(echo "$groups" | tr ' ' ',') groups_to_add=$(echo "$groups" | tr ' ' ',')
printf "%b" "${YELLOW}Are you sure you want to add user $username to $groups_to_add? [Y/n]: ${RC}" printf "%b" "${YELLOW}Are you sure you want to add user $username to $groups_to_add? [Y/n]: ${RC}"
read -r confirm read -r _
confirmAction || exit 1 confirmAction || exit 1
"$ESCALATION_TOOL" usermod -aG "$groups_to_add" "$username" "$ESCALATION_TOOL" usermod -aG "$groups_to_add" "$username"

View File

@ -11,7 +11,7 @@ createUser() {
printf "%b" "${YELLOW}Enter the username: ${RC}" printf "%b" "${YELLOW}Enter the username: ${RC}"
read -r username read -r username
if ! echo "$username" | grep '^[a-zA-Z]*$' > /dev/null; then if ! echo "$username" | grep '^[a-zA-Z]*$' >/dev/null; then
printf "%b\n" "${RED}Username must only contain letters and cannot contain spaces.${RC}" printf "%b\n" "${RED}Username must only contain letters and cannot contain spaces.${RC}"
exit 1 exit 1
fi fi

View File

@ -12,12 +12,12 @@ changePassword() {
printf "%b" "${YELLOW}Enter the username: ${RC}" printf "%b" "${YELLOW}Enter the username: ${RC}"
read -r username read -r username
if id "$username" > /dev/null 2>&1; then if id "$username" >/dev/null 2>&1; then
printf "%b" "${YELLOW}Enter new password: ${RC}" printf "%b" "${YELLOW}Enter new password: ${RC}"
read -r password read -r password
printf "%b" "${YELLOW}Are you sure you want to change password for ""$username""? [Y/n]: ${RC}" printf "%b" "${YELLOW}Are you sure you want to change password for ""$username""? [Y/n]: ${RC}"
read -r confirm read -r _
confirmAction || exit 1 confirmAction || exit 1
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd echo "$username:$password" | "$ESCALATION_TOOL" chpasswd

View File

@ -12,12 +12,12 @@ deleteUser() {
printf "%b" "${YELLOW}Enter the username: ${RC}" printf "%b" "${YELLOW}Enter the username: ${RC}"
read -r username read -r username
if id "$username" > /dev/null 2>&1; then if id "$username" >/dev/null 2>&1; then
printf "%b" "${YELLOW}Are you sure you want to delete user ""$username""? [Y/n]: ${RC}" printf "%b" "${YELLOW}Are you sure you want to delete user ""$username""? [Y/n]: ${RC}"
read -r confirm read -r _
confirmAction || exit 1 confirmAction || exit 1
$ESCALATION_TOOL userdel --remove "$username" 2>/dev/null "$ESCALATION_TOOL" userdel --remove "$username" 2>/dev/null
printf "%b\n" "${GREEN}User $username deleted successfully${RC}" printf "%b\n" "${GREEN}User $username deleted successfully${RC}"
else else
printf "%b\n" "${RED}User $username does not exist.${RC}" printf "%b\n" "${RED}User $username does not exist.${RC}"

View File

@ -12,7 +12,7 @@ removeFromGroup() {
printf "%b" "${YELLOW}Enter the username: ${RC}" printf "%b" "${YELLOW}Enter the username: ${RC}"
read -r username read -r username
if ! id "$username" > /dev/null 2>&1; then if ! id "$username" >/dev/null 2>&1; then
printf "%b\n" "${RED}User $username does not exist.${RC}" printf "%b\n" "${RED}User $username does not exist.${RC}"
exit 1 exit 1
fi fi
@ -34,10 +34,11 @@ removeFromGroup() {
groups_to_remove=$(echo "$groups" | tr ' ' ',') groups_to_remove=$(echo "$groups" | tr ' ' ',')
printf "%b" "${YELLOW}Are you sure you want to remove user $username from $groups_to_remove? [Y/n]: ${RC}" printf "%b" "${YELLOW}Are you sure you want to remove user $username from $groups_to_remove? [Y/n]: ${RC}"
read -r confirm read -r _
confirmAction || exit 1 confirmAction || exit 1
$ESCALATION_TOOL usermod -rG $groups_to_remove "$username" # shellcheck disable=SC2086
"$ESCALATION_TOOL" usermod -rG $groups_to_remove "$username"
printf "%b\n" "${GREEN}User successfully removed from $groups_to_remove${RC}" printf "%b\n" "${GREEN}User successfully removed from $groups_to_remove${RC}"
} }

View File

@ -2,7 +2,6 @@
. ../../common-script.sh . ../../common-script.sh
# Function to check xrandr is installed
setup_xrandr() { setup_xrandr() {
printf "%b\n" "${YELLOW}Installing xrandr...${RC}" printf "%b\n" "${YELLOW}Installing xrandr...${RC}"
if ! command_exists xrandr; then if ! command_exists xrandr; then
@ -10,7 +9,7 @@ setup_xrandr() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm xorg-xrandr "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm xorg-xrandr
;; ;;
apt-get|nala) apt-get | nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y x11-xserver-utils "$ESCALATION_TOOL" "$PACKAGER" install -y x11-xserver-utils
;; ;;
*) *)
@ -22,29 +21,26 @@ setup_xrandr() {
fi fi
} }
# Function to execute xrandr commands and handle errors
execute_command() { execute_command() {
command="$1" command="$1"
printf "Executing: %s\n" "$command" printf "Executing: %s\n" "$command"
eval "$command" 2>&1 | tee /tmp/xrandr.log | tail -n 20 eval "$command" 2>&1 | tee /tmp/xrandr.log | tail -n 20
#shellcheck disable=SC2181
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
printf "%b\n" "${RED}An error occurred while executing the command. Check /tmp/xrandr.log for details.${RC}" printf "%b\n" "${RED}An error occurred while executing the command. Check /tmp/xrandr.log for details.${RC}"
fi fi
} }
# Function to detect connected monitors
detect_connected_monitors() { detect_connected_monitors() {
xrandr_output=$(xrandr) xrandr_output=$(xrandr)
printf "%b\n" "$xrandr_output" | grep " connected" | awk '{print $1}' printf "%b\n" "$xrandr_output" | grep " connected" | awk '{print $1}'
} }
# Function to get the current brightness for a monitor
get_current_brightness() { get_current_brightness() {
monitor="$1" monitor="$1"
xrandr --verbose | grep -A 10 "^$monitor connected" | grep "Brightness:" | awk '{print $2}' xrandr --verbose | grep -A 10 "^$monitor connected" | grep "Brightness:" | awk '{print $2}'
} }
# Function to get resolutions for a monitor
get_unique_resolutions() { get_unique_resolutions() {
monitor="$1" monitor="$1"
xrandr_output=$(xrandr) xrandr_output=$(xrandr)
@ -53,7 +49,7 @@ get_unique_resolutions() {
standard_resolutions="1920x1080 1280x720 1600x900 2560x1440 3840x2160" standard_resolutions="1920x1080 1280x720 1600x900 2560x1440 3840x2160"
temp_file=$(mktemp) temp_file=$(mktemp)
printf "%s" "$available_resolutions" > "$temp_file" printf "%s" "$available_resolutions" >"$temp_file"
filtered_standard_resolutions=$(printf "%s" "$standard_resolutions" | tr ' ' '\n' | grep -xF -f "$temp_file") filtered_standard_resolutions=$(printf "%s" "$standard_resolutions" | tr ' ' '\n' | grep -xF -f "$temp_file")
@ -61,8 +57,8 @@ get_unique_resolutions() {
available_res_file=$(mktemp) available_res_file=$(mktemp)
filtered_standard_res_file=$(mktemp) filtered_standard_res_file=$(mktemp)
printf "%s" "$available_resolutions" | sort > "$available_res_file" printf "%s" "$available_resolutions" | sort >"$available_res_file"
printf "%s" "$filtered_standard_resolutions" | sort > "$filtered_standard_res_file" printf "%s" "$filtered_standard_resolutions" | sort >"$filtered_standard_res_file"
remaining_resolutions=$(comm -23 "$available_res_file" "$filtered_standard_res_file") remaining_resolutions=$(comm -23 "$available_res_file" "$filtered_standard_res_file")
@ -71,7 +67,6 @@ get_unique_resolutions() {
printf "%b\n" "$filtered_standard_resolutions\n$remaining_resolutions" | head -n 10 printf "%b\n" "$filtered_standard_resolutions\n$remaining_resolutions" | head -n 10
} }
# Function to prompt for confirmation
confirm_action() { confirm_action() {
action="$1" action="$1"
printf "%b\n" "${CYAN}$action${RC}" printf "%b\n" "${CYAN}$action${RC}"

View File

@ -2,7 +2,6 @@
. ../common-script.sh . ../common-script.sh
# Function to check if NetworkManager is installed
setupNetworkManager() { setupNetworkManager() {
printf "%b\n" "${YELLOW}Installing NetworkManager...${RC}" printf "%b\n" "${YELLOW}Installing NetworkManager...${RC}"
if ! command_exists nmcli; then if ! command_exists nmcli; then
@ -21,7 +20,6 @@ setupNetworkManager() {
printf "%b\n" "${YELLOW}NetworkManager is already installed.${RC}" printf "%b\n" "${YELLOW}NetworkManager is already installed.${RC}"
fi fi
# Check if NetworkManager service is running
if ! systemctl is-active --quiet NetworkManager; then if ! systemctl is-active --quiet NetworkManager; then
printf "%b\n" "${YELLOW}NetworkManager service is not running. Starting it now...${RC}" printf "%b\n" "${YELLOW}NetworkManager service is not running. Starting it now...${RC}"
"$ESCALATION_TOOL" systemctl start NetworkManager "$ESCALATION_TOOL" systemctl start NetworkManager
@ -32,7 +30,6 @@ setupNetworkManager() {
fi fi
} }
# Function to display the main menu
main_menu() { main_menu() {
while true; do while true; do
clear clear
@ -61,7 +58,6 @@ main_menu() {
done done
} }
# Function to scan for WiFi networks
scan_networks() { scan_networks() {
clear clear
printf "%b\n" "${YELLOW}Scanning for WiFi networks...${RC}" printf "%b\n" "${YELLOW}Scanning for WiFi networks...${RC}"
@ -73,36 +69,33 @@ scan_networks() {
echo "$networks" | awk -F: '{printf("%d. SSID: %-25s \n", NR, $1)}' echo "$networks" | awk -F: '{printf("%d. SSID: %-25s \n", NR, $1)}'
fi fi
printf "%b\n" "Press any key to return to the main menu..." printf "%b\n" "Press any key to return to the main menu..."
read -r dummy read -r _
} }
# Function to turn WiFi on
wifi_on() { wifi_on() {
clear clear
printf "%b\n" "${YELLOW}Turning WiFi on...${RC}" printf "%b\n" "${YELLOW}Turning WiFi on...${RC}"
nmcli radio wifi on && { if nmcli radio wifi on; then
printf "%b\n" "${GREEN}WiFi is now turned on.${RC}" printf "%b\n" "${GREEN}WiFi is now turned on.${RC}"
} || { else
printf "%b\n" "${RED}Failed to turn on WiFi.${RC}" printf "%b\n" "${RED}Failed to turn on WiFi.${RC}"
} fi
printf "%b\n" "Press any key to return to the main menu..." printf "%b\n" "Press any key to return to the main menu..."
read -r dummy read -r _
} }
# Function to turn WiFi off
wifi_off() { wifi_off() {
clear clear
printf "%b\n" "${YELLOW}Turning WiFi off...${RC}" printf "%b\n" "${YELLOW}Turning WiFi off...${RC}"
nmcli radio wifi off && { if nmcli radio wifi off; then
printf "%b\n" "${GREEN}WiFi is now turned off.${RC}" printf "%b\n" "${GREEN}WiFi is now turned off.${RC}"
} || { else
printf "%b\n" "${RED}Failed to turn off WiFi.${RC}" printf "%b\n" "${RED}Failed to turn off WiFi.${RC}"
} fi
printf "%b\n" "Press any key to return to the main menu..." printf "%b\n" "Press any key to return to the main menu..."
read -r dummy read -r _
} }
# Function to prompt for WiFi network selection
prompt_for_network() { prompt_for_network() {
action=$1 action=$1
prompt_msg=$2 prompt_msg=$2
@ -116,19 +109,19 @@ prompt_for_network() {
if [ -z "$networks" ]; then if [ -z "$networks" ]; then
printf "%b\n" "${RED}No networks available. Please scan for networks first.${RC}" printf "%b\n" "${RED}No networks available. Please scan for networks first.${RC}"
printf "%b\n" "Press any key to return to the main menu..." printf "%b\n" "Press any key to return to the main menu..."
read -r dummy read -r _
rm -f "$temp_file" rm -f "$temp_file"
return return
fi fi
echo "$networks" > "$temp_file" echo "$networks" >"$temp_file"
i=1 i=1
while IFS= read -r network; do while IFS= read -r network; do
ssid=$(echo "$network" | awk -F: '{print $1}') ssid=$(echo "$network" | awk -F: '{print $1}')
printf "%b\n" "$i. SSID: " "$ssid" printf "%b\n" "$i. SSID: " "$ssid"
i=$((i + 1)) i=$((i + 1))
done < "$temp_file" done <"$temp_file"
printf "%b\n" "0. Exit to main menu" printf "%b\n" "0. Exit to main menu"
printf "%b" "$prompt_msg" printf "%b" "$prompt_msg"
@ -140,39 +133,35 @@ prompt_for_network() {
printf "%b" "Enter password for SSID: " "$ssid" printf "%b" "Enter password for SSID: " "$ssid"
read -r password read -r password
printf "\n" printf "\n"
nmcli dev wifi connect "$ssid" password "$password" && { if nmcli dev wifi connect "$ssid" password "$password"; then
printf "%b\n" "${GREEN}$success_msg${RC}" printf "%b\n" "${GREEN}${success_msg}${RC}"
} || { else
printf "%b\n" "${RED}$failure_msg${RC}" printf "%b\n" "${RED}${failure_msg}${RC}"
} fi
fi fi
else else
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}" printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
fi fi
printf "%b\n" "Press any key to return to the selection menu..." printf "%b\n" "Press any key to return to the selection menu..."
read -r dummy read -r _
done done
rm -f "$temp_file" rm -f "$temp_file"
} }
# Function to connect to a WiFi network
connect_network() { connect_network() {
prompt_for_network "connect" "Enter the number of the network to connect: " "Connected to the network successfully." "Failed to connect to the network." prompt_for_network "connect" "Enter the number of the network to connect: " "Connected to the network successfully." "Failed to connect to the network."
} }
# Function to disconnect from a WiFi network
disconnect_network() { disconnect_network() {
prompt_for_network "disconnect" "Enter the number of the network to disconnect: " "Disconnected from the network successfully." "Failed to disconnect from the network." prompt_for_network "disconnect" "Enter the number of the network to disconnect: " "Disconnected from the network successfully." "Failed to disconnect from the network."
} }
# Function to remove a WiFi connection
remove_network() { remove_network() {
prompt_for_network "remove" "Enter the number of the network to remove: " "Network removed successfully." "Failed to remove the network." prompt_for_network "remove" "Enter the number of the network to remove: " "Network removed successfully." "Failed to remove the network."
} }
# Initialize
checkEnv checkEnv
checkEscalationTool checkEscalationTool
setupNetworkManager setupNetworkManager

View File

@ -2,10 +2,10 @@
# Prevent execution if this script was only partially downloaded # Prevent execution if this script was only partially downloaded
{ {
rc='\033[0m' rc='\033[0m'
red='\033[0;31m' red='\033[0;31m'
check() { check() {
exit_code=$1 exit_code=$1
message=$2 message=$2
@ -16,36 +16,36 @@ check() {
unset exit_code unset exit_code
unset message unset message
} }
findArch() { findArch() {
case "$(uname -m)" in case "$(uname -m)" in
x86_64|amd64) arch="x86_64" ;; x86_64 | amd64) arch="x86_64" ;;
aarch64|arm64) arch="aarch64" ;; aarch64 | arm64) arch="aarch64" ;;
*) check 1 "Unsupported architecture" *) check 1 "Unsupported architecture" ;;
esac esac
} }
getUrl() { getUrl() {
case "${arch}" in case "${arch}" in
x86_64) echo "https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil";; x86_64) echo "https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil" ;;
*) echo "https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil-${arch}";; *) echo "https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil-${arch}" ;;
esac esac
} }
findArch findArch
temp_file=$(mktemp) temp_file=$(mktemp)
check $? "Creating the temporary file" check $? "Creating the temporary file"
curl -fsL "$(getUrl)" -o "$temp_file" curl -fsL "$(getUrl)" -o "$temp_file"
check $? "Downloading linutil" check $? "Downloading linutil"
chmod +x "$temp_file" chmod +x "$temp_file"
check $? "Making linutil executable" check $? "Making linutil executable"
"$temp_file" "$temp_file"
check $? "Executing linutil" check $? "Executing linutil"
rm -f "$temp_file" rm -f "$temp_file"
check $? "Deleting the temporary file" check $? "Deleting the temporary file"
} # End of wrapping } # End of wrapping

View File

@ -2,11 +2,11 @@
# Prevent execution if this script was only partially downloaded # Prevent execution if this script was only partially downloaded
{ {
RC='\033[0m' RC='\033[0m'
RED='\033[0;31m' RED='\033[0;31m'
# Function to fetch the latest release tag from the GitHub API # Function to fetch the latest release tag from the GitHub API
get_latest_release() { get_latest_release() {
latest_release=$(curl -s https://api.github.com/repos/ChrisTitusTech/linutil/releases | latest_release=$(curl -s https://api.github.com/repos/ChrisTitusTech/linutil/releases |
grep -oP '"tag_name": "\K[^"]*' | grep -oP '"tag_name": "\K[^"]*' |
head -n 1) head -n 1)
@ -15,10 +15,10 @@ get_latest_release() {
return 1 return 1
fi fi
printf "%b\n" "$latest_release" printf "%b\n" "$latest_release"
} }
# Function to redirect to the latest pre-release version # Function to redirect to the latest pre-release version
redirect_to_latest_pre_release() { redirect_to_latest_pre_release() {
latest_release=$(get_latest_release) latest_release=$(get_latest_release)
if [ -n "$latest_release" ]; then if [ -n "$latest_release" ]; then
url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil" url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil"
@ -29,9 +29,9 @@ redirect_to_latest_pre_release() {
fi fi
addArch addArch
printf "%b\n" "Using URL: $url" printf "%b\n" "Using URL: $url"
} }
check() { check() {
exit_code=$1 exit_code=$1
message=$2 message=$2
@ -39,39 +39,39 @@ check() {
printf "%b\n" "${RED}ERROR: $message${RC}" printf "%b\n" "${RED}ERROR: $message${RC}"
exit 1 exit 1
fi fi
} }
addArch() { addArch() {
case "${arch}" in case "${arch}" in
x86_64);; x86_64) ;;
*) url="${url}-${arch}";; *) url="${url}-${arch}" ;;
esac esac
} }
findArch() { findArch() {
case "$(uname -m)" in case "$(uname -m)" in
x86_64|amd64) arch="x86_64" ;; x86_64 | amd64) arch="x86_64" ;;
aarch64|arm64) arch="aarch64" ;; aarch64 | arm64) arch="aarch64" ;;
*) check 1 "Unsupported architecture" *) check 1 "Unsupported architecture" ;;
esac esac
} }
findArch findArch
redirect_to_latest_pre_release redirect_to_latest_pre_release
TMPFILE=$(mktemp) TMPFILE=$(mktemp)
check $? "Creating the temporary file" check $? "Creating the temporary file"
printf "%b\n" "Downloading linutil from $url" printf "%b\n" "Downloading linutil from $url"
curl -fsL "$url" -o "$TMPFILE" curl -fsL "$url" -o "$TMPFILE"
check $? "Downloading linutil" check $? "Downloading linutil"
chmod +x "$TMPFILE" chmod +x "$TMPFILE"
check $? "Making linutil executable" check $? "Making linutil executable"
"$TMPFILE" "$TMPFILE"
check $? "Executing linutil" check $? "Executing linutil"
rm -f "$TMPFILE" rm -f "$TMPFILE"
check $? "Deleting the temporary file" check $? "Deleting the temporary file"
} # End of wrapping } # End of wrapping