mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Quote the remaining variables (#454)
Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
parent
1175f7d236
commit
0d4f0a8a4e
|
@ -7,10 +7,10 @@ installAlacritty() {
|
||||||
if ! command_exists alacritty; then
|
if ! command_exists alacritty; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm alacritty
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y alacritty
|
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,14 +6,14 @@ setupDWM() {
|
||||||
printf "%b\n" "${YELLOW}Installing DWM-Titus if not already installed${RC}"
|
printf "%b\n" "${YELLOW}Installing DWM-Titus if not already installed${RC}"
|
||||||
case "$PACKAGER" in # Install pre-Requisites
|
case "$PACKAGER" in # Install pre-Requisites
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git
|
||||||
;;
|
;;
|
||||||
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
|
"$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
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" groupinstall -y "Development Tools"
|
"$ESCALATION_TOOL" "$PACKAGER" groupinstall -y "Development Tools"
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
|
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||||
|
@ -26,7 +26,7 @@ makeDWM() {
|
||||||
cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus
|
cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus
|
||||||
# This path can be changed (e.g. to linux-toolbox directory)
|
# This path can be changed (e.g. to linux-toolbox directory)
|
||||||
cd dwm-titus/ # Hardcoded path, maybe not the best.
|
cd dwm-titus/ # Hardcoded path, maybe not the best.
|
||||||
$ESCALATION_TOOL make clean install # Run make clean install
|
"$ESCALATION_TOOL" make clean install # Run make clean install
|
||||||
}
|
}
|
||||||
|
|
||||||
install_nerd_font() {
|
install_nerd_font() {
|
||||||
|
@ -115,7 +115,7 @@ picom_animations() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install the built binary
|
# Install the built binary
|
||||||
if ! $ESCALATION_TOOL ninja -C build install; then
|
if ! "$ESCALATION_TOOL" ninja -C build install; then
|
||||||
printf "%b\n" "${RED}Failed to install the built binary${RC}"
|
printf "%b\n" "${RED}Failed to install the built binary${RC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -179,13 +179,13 @@ setupDisplayManager() {
|
||||||
printf "%b\n" "${YELLOW}Setting up Xorg${RC}"
|
printf "%b\n" "${YELLOW}Setting up Xorg${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
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}"
|
||||||
|
@ -207,13 +207,13 @@ setupDisplayManager() {
|
||||||
printf "%b\n" "${YELLOW}No display manager found, installing $DM${RC}"
|
printf "%b\n" "${YELLOW}No display manager found, installing $DM${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
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}"
|
||||||
|
@ -232,28 +232,28 @@ setupDisplayManager() {
|
||||||
printf "%b\n" "${YELLOW}Configuring SDDM for autologin${RC}"
|
printf "%b\n" "${YELLOW}Configuring SDDM for autologin${RC}"
|
||||||
SDDM_CONF="/etc/sddm.conf"
|
SDDM_CONF="/etc/sddm.conf"
|
||||||
if [ ! -f "$SDDM_CONF" ]; then
|
if [ ! -f "$SDDM_CONF" ]; then
|
||||||
echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "[Autologin]" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "User=$USER" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "Session=dwm" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
else
|
else
|
||||||
$ESCALATION_TOOL sed -i '/^\[Autologin\]/d' "$SDDM_CONF"
|
"$ESCALATION_TOOL" sed -i '/^\[Autologin\]/d' "$SDDM_CONF"
|
||||||
$ESCALATION_TOOL sed -i '/^User=/d' "$SDDM_CONF"
|
"$ESCALATION_TOOL" sed -i '/^User=/d' "$SDDM_CONF"
|
||||||
$ESCALATION_TOOL sed -i '/^Session=/d' "$SDDM_CONF"
|
"$ESCALATION_TOOL" sed -i '/^Session=/d' "$SDDM_CONF"
|
||||||
echo "[Autologin]" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "[Autologin]" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
echo "User=$USER" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "User=$USER" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
echo "Session=dwm" | $ESCALATION_TOOL tee -a "$SDDM_CONF"
|
echo "Session=dwm" | "$ESCALATION_TOOL" tee -a "$SDDM_CONF"
|
||||||
fi
|
fi
|
||||||
printf "%b\n" "{YELLOW}Checking if autologin group exists${RC}"
|
printf "%b\n" "{YELLOW}Checking if autologin group exists${RC}"
|
||||||
if ! getent group autologin > /dev/null; then
|
if ! getent group autologin > /dev/null; then
|
||||||
printf "%b\n" "${YELLOW}Creating autologin group${RC}"
|
printf "%b\n" "${YELLOW}Creating autologin group${RC}"
|
||||||
$ESCALATION_TOOL groupadd autologin
|
"$ESCALATION_TOOL" groupadd autologin
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Autologin group already exists${RC}"
|
printf "%b\n" "${GREEN}Autologin group already exists${RC}"
|
||||||
fi
|
fi
|
||||||
printf "%b\n" "${YELLOW}Adding user with UID 1000 to autologin group${RC}"
|
printf "%b\n" "${YELLOW}Adding user with UID 1000 to autologin group${RC}"
|
||||||
USER_UID_1000=$(getent passwd 1000 | cut -d: -f1)
|
USER_UID_1000=$(getent passwd 1000 | cut -d: -f1)
|
||||||
if [ -n "$USER_UID_1000" ]; then
|
if [ -n "$USER_UID_1000" ]; then
|
||||||
$ESCALATION_TOOL usermod -aG autologin "$USER_UID_1000"
|
"$ESCALATION_TOOL" usermod -aG autologin "$USER_UID_1000"
|
||||||
printf "%b\n" "${GREEN}User $USER_UID_1000 added to autologin group${RC}"
|
printf "%b\n" "${GREEN}User $USER_UID_1000 added to autologin group${RC}"
|
||||||
else
|
else
|
||||||
printf "%b\n" "${RED}No user with UID 1000 found - Auto login not possible${RC}"
|
printf "%b\n" "${RED}No user with UID 1000 found - Auto login not possible${RC}"
|
||||||
|
@ -272,7 +272,7 @@ install_slstatus() {
|
||||||
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" || { echo "Failed to change directory to slstatus"; return 1; }
|
cd "$HOME/dwm-titus/slstatus" || { echo "Failed to change directory to slstatus"; 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
|
||||||
printf "%b\n" "${RED}Failed to install slstatus${RC}"
|
printf "%b\n" "${RED}Failed to install slstatus${RC}"
|
||||||
|
|
|
@ -7,10 +7,10 @@ installFastfetch() {
|
||||||
if ! command_exists fastfetch; then
|
if ! command_exists fastfetch; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm fastfetch
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y fastfetch
|
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,10 +7,10 @@ installKitty() {
|
||||||
if ! command_exists kitty; then
|
if ! command_exists kitty; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm kitty
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y kitty
|
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,16 +8,16 @@ installDepend() {
|
||||||
printf "%b\n" "${YELLOW}Installing Bash...${RC}"
|
printf "%b\n" "${YELLOW}Installing Bash...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git
|
||||||
;;
|
;;
|
||||||
apt)
|
apt)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original mybash-setup-script.
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original mybash-setup-script.
|
||||||
|
@ -70,7 +70,7 @@ installStarshipAndFzf() {
|
||||||
printf "%b\n" "${GREEN}Fzf already installed${RC}"
|
printf "%b\n" "${GREEN}Fzf already installed${RC}"
|
||||||
else
|
else
|
||||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||||
$ESCALATION_TOOL ~/.fzf/install
|
"$ESCALATION_TOOL" ~/.fzf/install
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,16 @@ installNeovim() {
|
||||||
printf "%b\n" "${YELLOW}Installing Neovim...${RC}"
|
printf "%b\n" "${YELLOW}Installing Neovim...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
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)
|
apt)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$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
|
||||||
;;
|
;;
|
||||||
zypper)
|
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
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original nvim-setup-script.
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original nvim-setup-script.
|
||||||
|
|
|
@ -7,10 +7,10 @@ installRofi() {
|
||||||
if ! command_exists rofi; then
|
if ! command_exists rofi; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm rofi
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rofi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y rofi
|
"$ESCALATION_TOOL" "$PACKAGER" install -y rofi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,10 +8,10 @@ installZsh() {
|
||||||
if ! command_exists zsh; then
|
if ! command_exists zsh; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm zsh
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zsh
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y zsh
|
"$ESCALATION_TOOL" "$PACKAGER" install -y zsh
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -44,7 +44,7 @@ RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
||||||
echo 'export ZDOTDIR="$HOME/.config/zsh"' | $ESCALATION_TOOL tee -a /etc/zsh/zshenv
|
echo 'export ZDOTDIR="$HOME/.config/zsh"' | "$ESCALATION_TOOL" tee -a /etc/zsh/zshenv
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
|
@ -27,8 +27,8 @@ checkAURHelper() {
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Installing yay as AUR helper..."
|
echo "Installing yay as AUR helper..."
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel
|
||||||
cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-bin.git && $ESCALATION_TOOL chown -R "$USER":"$USER" ./yay-bin
|
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER":"$USER" ./yay-bin
|
||||||
cd yay-bin && makepkg --noconfirm -si
|
cd yay-bin && makepkg --noconfirm -si
|
||||||
|
|
||||||
if command_exists yay; then
|
if command_exists yay; then
|
||||||
|
|
|
@ -7,10 +7,10 @@ installPkg() {
|
||||||
if ! command_exists ufw; then
|
if ! command_exists ufw; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm ufw
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y ufw
|
"$ESCALATION_TOOL" "$PACKAGER" install -y ufw
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -22,24 +22,24 @@ configureUFW() {
|
||||||
printf "%b\n" "${YELLOW}Using Chris Titus Recommended Firewall Rules${RC}"
|
printf "%b\n" "${YELLOW}Using Chris Titus Recommended Firewall Rules${RC}"
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Disabling UFW${RC}"
|
printf "%b\n" "${YELLOW}Disabling UFW${RC}"
|
||||||
$ESCALATION_TOOL ufw disable
|
"$ESCALATION_TOOL" ufw disable
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Limiting port 22/tcp (UFW)${RC}"
|
printf "%b\n" "${YELLOW}Limiting port 22/tcp (UFW)${RC}"
|
||||||
$ESCALATION_TOOL ufw limit 22/tcp
|
"$ESCALATION_TOOL" ufw limit 22/tcp
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
|
printf "%b\n" "${YELLOW}Allowing port 80/tcp (UFW)${RC}"
|
||||||
$ESCALATION_TOOL ufw allow 80/tcp
|
"$ESCALATION_TOOL" ufw allow 80/tcp
|
||||||
|
|
||||||
printf "%b\n" "${YELLO}Allowing port 443/tcp (UFW)${RC}"
|
printf "%b\n" "${YELLO}Allowing port 443/tcp (UFW)${RC}"
|
||||||
$ESCALATION_TOOL ufw allow 443/tcp
|
"$ESCALATION_TOOL" ufw allow 443/tcp
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
|
printf "%b\n" "${YELLOW}Denying Incoming Packets by Default(UFW)${RC}"
|
||||||
$ESCALATION_TOOL ufw default deny incoming
|
"$ESCALATION_TOOL" ufw default deny incoming
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Allowing Outcoming Packets by Default(UFW)${RC}"
|
printf "%b\n" "${YELLOW}Allowing Outcoming Packets by Default(UFW)${RC}"
|
||||||
$ESCALATION_TOOL ufw default allow outgoing
|
"$ESCALATION_TOOL" ufw default allow outgoing
|
||||||
|
|
||||||
$ESCALATION_TOOL ufw enable
|
"$ESCALATION_TOOL" ufw enable
|
||||||
printf "%b\n" "${GREEN}Enabled Firewall with Baselines!${RC}"
|
printf "%b\n" "${GREEN}Enabled Firewall with Baselines!${RC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,36 +9,36 @@ installDepend() {
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
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
|
||||||
$ESCALATION_TOOL "$PACKAGER" -Syu
|
"$ESCALATION_TOOL" "$PACKAGER" -Syu
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
||||||
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
|
||||||
$ESCALATION_TOOL "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
COMPILEDEPS='@development-tools'
|
COMPILEDEPS='@development-tools'
|
||||||
$ESCALATION_TOOL "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
$ESCALATION_TOOL "$PACKAGER" config-manager --set-enabled powertools
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled powertools
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
"$ESCALATION_TOOL" "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||||
$ESCALATION_TOOL "$PACKAGER" refresh
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
||||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
|
||||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
|
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,19 @@ install_theme_tools() {
|
||||||
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
|
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
$ESCALATION_TOOL "$PACKAGER" refresh
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
||||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive install qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install qt6ct kvantum
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
|
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
|
||||||
|
@ -41,7 +41,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}\n"
|
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n"
|
||||||
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}\n"
|
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n"
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
|
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
|
||||||
|
|
|
@ -5,19 +5,19 @@
|
||||||
removeSnaps() {
|
removeSnaps() {
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
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)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" remove snapd
|
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
$ESCALATION_TOOL "$PACKAGER" remove snapd
|
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}"
|
printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}"
|
||||||
|
|
|
@ -9,8 +9,8 @@ installRPMFusion() {
|
||||||
dnf)
|
dnf)
|
||||||
if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
|
if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
|
||||||
echo "Installing RPM Fusion..."
|
echo "Installing RPM Fusion..."
|
||||||
$ESCALATION_TOOL "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
"$ESCALATION_TOOL" "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
||||||
$ESCALATION_TOOL "$PACKAGER" config-manager --enable fedora-cisco-openh264
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264
|
||||||
echo "RPM Fusion installed"
|
echo "RPM Fusion installed"
|
||||||
else
|
else
|
||||||
echo "RPM Fusion already installed"
|
echo "RPM Fusion already installed"
|
||||||
|
|
|
@ -9,7 +9,7 @@ fastUpdate() {
|
||||||
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
|
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
|
||||||
|
|
||||||
if [ -s /etc/pacman.d/mirrorlist ]; then
|
if [ -s /etc/pacman.d/mirrorlist ]; then
|
||||||
$ESCALATION_TOOL cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
|
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
|
||||||
|
@ -18,40 +18,40 @@ 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}
|
"$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local}
|
||||||
if [ $? -ne 0 ] || [ ! -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
|
||||||
$ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
"$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||||
$ESCALATION_TOOL nala update
|
"$ESCALATION_TOOL" nala update
|
||||||
PACKAGER="nala"
|
PACKAGER="nala"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$ESCALATION_TOOL "$PACKAGER" upgrade -y
|
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update -y
|
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
$ESCALATION_TOOL "$PACKAGER" ref
|
"$ESCALATION_TOOL" "$PACKAGER" ref
|
||||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive dup
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
|
||||||
;;
|
;;
|
||||||
yum)
|
yum)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update -y
|
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||||
$ESCALATION_TOOL "$PACKAGER" upgrade -y
|
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||||
;;
|
;;
|
||||||
xbps-install)
|
xbps-install)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -Syu
|
"$ESCALATION_TOOL" "$PACKAGER" -Syu-
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||||
|
@ -64,23 +64,23 @@ updateSystem() {
|
||||||
printf "%b\n" "${GREEN}Updating system${RC}"
|
printf "%b\n" "${GREEN}Updating system${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
nala|apt-get)
|
nala|apt-get)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update -y
|
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||||
$ESCALATION_TOOL "$PACKAGER" upgrade -y
|
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||||
;;
|
;;
|
||||||
yum|dnf)
|
yum|dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" update -y
|
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||||
$ESCALATION_TOOL "$PACKAGER" upgrade -y
|
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
|
"$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
|
||||||
$ESCALATION_TOOL "$PACKAGER" -Su --noconfirm
|
"$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
$ESCALATION_TOOL "$PACKAGER" ref
|
"$ESCALATION_TOOL" "$PACKAGER" ref
|
||||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive dup
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
|
||||||
;;
|
;;
|
||||||
xbps-install)
|
xbps-install)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -Syu
|
"$ESCALATION_TOOL" "$PACKAGER" -Syu
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||||
|
|
|
@ -8,10 +8,10 @@ setupBluetooth() {
|
||||||
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
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y bluez
|
"$ESCALATION_TOOL" "$PACKAGER" install -y bluez
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -21,7 +21,7 @@ setupBluetooth() {
|
||||||
# Check if bluetooth service is running
|
# 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
|
||||||
|
|
||||||
if systemctl is-active --quiet bluetooth; then
|
if systemctl is-active --quiet bluetooth; then
|
||||||
printf "%b\n" "${GREEN}Bluetooth service started successfully.${RC}"
|
printf "%b\n" "${GREEN}Bluetooth service started successfully.${RC}"
|
||||||
|
|
|
@ -8,13 +8,13 @@ setup_xrandr() {
|
||||||
if ! command_exists xrandr; then
|
if ! command_exists xrandr; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
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
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-server-utils
|
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-server-utils
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
create_file() {
|
create_file() {
|
||||||
echo "Creating script..."
|
echo "Creating script..."
|
||||||
$ESCALATION_TOOL tee "/usr/local/bin/numlock" >/dev/null <<'EOF'
|
"$ESCALATION_TOOL" tee "/usr/local/bin/numlock" >/dev/null <<'EOF'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for tty in /dev/tty{1..6}
|
for tty in /dev/tty{1..6}
|
||||||
|
@ -18,13 +18,13 @@ do
|
||||||
done
|
done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
$ESCALATION_TOOL chmod +x /usr/local/bin/numlock
|
"$ESCALATION_TOOL" chmod +x /usr/local/bin/numlock
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a systemd service to run the script on boot
|
# Create a systemd service to run the script on boot
|
||||||
create_service() {
|
create_service() {
|
||||||
echo "Creating service..."
|
echo "Creating service..."
|
||||||
$ESCALATION_TOOL tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF'
|
"$ESCALATION_TOOL" tee "/etc/systemd/system/numlock.service" >/dev/null <<'EOF'
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=numlock
|
Description=numlock
|
||||||
|
|
||||||
|
@ -51,10 +51,10 @@ numlockSetup() {
|
||||||
printf "Do you want to enable Numlock on boot? (y/n): "
|
printf "Do you want to enable Numlock on boot? (y/n): "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
||||||
$ESCALATION_TOOL systemctl enable numlock.service --quiet
|
"$ESCALATION_TOOL" systemctl enable numlock.service --quiet
|
||||||
echo "Numlock will be enabled on boot"
|
echo "Numlock will be enabled on boot"
|
||||||
else
|
else
|
||||||
$ESCALATION_TOOL systemctl disable numlock.service --quiet
|
"$ESCALATION_TOOL" systemctl disable numlock.service --quiet
|
||||||
echo "Numlock will not be enabled on boot"
|
echo "Numlock will not be enabled on boot"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -12,7 +12,7 @@ installollama() {
|
||||||
else
|
else
|
||||||
printf "%b\n" "${YELLOW}Installing ollama...${RC}"
|
printf "%b\n" "${YELLOW}Installing ollama...${RC}"
|
||||||
curl -fsSL https://ollama.com/install.sh | sh
|
curl -fsSL https://ollama.com/install.sh | sh
|
||||||
$ESCALATION_TOOL systemctl start ollama
|
"$ESCALATION_TOOL" systemctl start ollama
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,25 +29,25 @@ show_menu() {
|
||||||
# Function to view all services
|
# Function to view all services
|
||||||
view_all_services() {
|
view_all_services() {
|
||||||
echo "Listing all services..."
|
echo "Listing all services..."
|
||||||
$ESCALATION_TOOL systemctl list-units --type=service --all --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
"$ESCALATION_TOOL" systemctl list-units --type=service --all --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to view enabled services
|
# Function to view enabled services
|
||||||
view_enabled_services() {
|
view_enabled_services() {
|
||||||
echo "Listing enabled services..."
|
echo "Listing enabled services..."
|
||||||
$ESCALATION_TOOL systemctl list-unit-files --type=service --state=enabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
"$ESCALATION_TOOL" systemctl list-unit-files --type=service --state=enabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to view disabled services
|
# Function to view disabled services
|
||||||
view_disabled_services() {
|
view_disabled_services() {
|
||||||
echo "Listing disabled services..."
|
echo "Listing disabled services..."
|
||||||
$ESCALATION_TOOL systemctl list-unit-files --type=service --state=disabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
"$ESCALATION_TOOL" systemctl list-unit-files --type=service --state=disabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to view started services
|
# Function to view started services
|
||||||
view_started_services() {
|
view_started_services() {
|
||||||
echo "Listing started services:"
|
echo "Listing started services:"
|
||||||
$ESCALATION_TOOL systemctl list-units --type=service --state=running --no-pager | head -n -6 | awk 'NR>1 {print $1}' | more
|
"$ESCALATION_TOOL" systemctl list-units --type=service --state=running --no-pager | head -n -6 | awk 'NR>1 {print $1}' | more
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add a new service
|
# Function to add a new service
|
||||||
|
@ -56,7 +56,7 @@ add_service() {
|
||||||
echo "Enter the name of the new service (e.g., my_service):"
|
echo "Enter the name of the new service (e.g., my_service):"
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if $ESCALATION_TOOL systemctl list-units --type=service --all --no-legend | grep -q "$SERVICE_NAME.service"; then
|
if "$ESCALATION_TOOL" systemctl list-units --type=service --all --no-legend | grep -q "$SERVICE_NAME.service"; then
|
||||||
echo "Service already exists!"
|
echo "Service already exists!"
|
||||||
SERVICE_NAME=""
|
SERVICE_NAME=""
|
||||||
fi
|
fi
|
||||||
|
@ -93,11 +93,11 @@ add_service() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "[Install]"
|
echo "[Install]"
|
||||||
echo "WantedBy=multi-user.target"
|
echo "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"
|
||||||
$ESCALATION_TOOL systemctl daemon-reload
|
"$ESCALATION_TOOL" systemctl daemon-reload
|
||||||
echo "Service $SERVICE_NAME has been created and is ready to be started."
|
echo "Service $SERVICE_NAME has been created and is ready to be started."
|
||||||
|
|
||||||
# Optionally, enable and start the service
|
# Optionally, enable and start the service
|
||||||
|
@ -105,8 +105,8 @@ add_service() {
|
||||||
read -r START_ENABLE
|
read -r START_ENABLE
|
||||||
|
|
||||||
if [ "$START_ENABLE" = "y" ]; then
|
if [ "$START_ENABLE" = "y" ]; then
|
||||||
$ESCALATION_TOOL systemctl start "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||||
$ESCALATION_TOOL systemctl enable "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||||
echo "Service $SERVICE_NAME has been started and enabled."
|
echo "Service $SERVICE_NAME has been started and enabled."
|
||||||
else
|
else
|
||||||
echo "Service $SERVICE_NAME has been created but not started."
|
echo "Service $SERVICE_NAME has been created but not started."
|
||||||
|
@ -122,12 +122,12 @@ remove_service() {
|
||||||
|
|
||||||
if [ -f "$SERVICE_FILE" ]; then
|
if [ -f "$SERVICE_FILE" ]; then
|
||||||
echo "Stopping and disabling the service..."
|
echo "Stopping and disabling the service..."
|
||||||
$ESCALATION_TOOL systemctl stop "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"
|
||||||
$ESCALATION_TOOL systemctl disable "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"
|
||||||
|
|
||||||
echo "Removing the service file..."
|
echo "Removing the service file..."
|
||||||
$ESCALATION_TOOL rm -f "$SERVICE_FILE"
|
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
|
||||||
$ESCALATION_TOOL systemctl daemon-reload
|
"$ESCALATION_TOOL" systemctl daemon-reload
|
||||||
|
|
||||||
echo "Service $SERVICE_NAME has been removed."
|
echo "Service $SERVICE_NAME has been removed."
|
||||||
else
|
else
|
||||||
|
@ -141,7 +141,7 @@ start_service() {
|
||||||
echo "Enter the name of the service to start (e.g., my_service):"
|
echo "Enter the name of the service to start (e.g., my_service):"
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if $ESCALATION_TOOL systemctl start "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
|
||||||
echo "Service $SERVICE_NAME has been started."
|
echo "Service $SERVICE_NAME has been started."
|
||||||
else
|
else
|
||||||
echo "Failed to start service: $SERVICE_NAME."
|
echo "Failed to start service: $SERVICE_NAME."
|
||||||
|
@ -154,7 +154,7 @@ stop_service() {
|
||||||
echo "Enter the name of the service to stop (e.g., my_service):"
|
echo "Enter the name of the service to stop (e.g., my_service):"
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if $ESCALATION_TOOL systemctl stop "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
|
||||||
echo "Service $SERVICE_NAME has been stopped."
|
echo "Service $SERVICE_NAME has been stopped."
|
||||||
else
|
else
|
||||||
echo "Failed to stop service: $SERVICE_NAME."
|
echo "Failed to stop service: $SERVICE_NAME."
|
||||||
|
@ -167,7 +167,7 @@ enable_service() {
|
||||||
echo "Enter the name of the service to enable (e.g., my_service):"
|
echo "Enter the name of the service to enable (e.g., my_service):"
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if $ESCALATION_TOOL systemctl enable "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
|
||||||
echo "Service $SERVICE_NAME has been enabled."
|
echo "Service $SERVICE_NAME has been enabled."
|
||||||
else
|
else
|
||||||
echo "Failed to enable service: $SERVICE_NAME."
|
echo "Failed to enable service: $SERVICE_NAME."
|
||||||
|
@ -180,7 +180,7 @@ disable_service() {
|
||||||
echo "Enter the name of the service to disable (e.g., my_service):"
|
echo "Enter the name of the service to disable (e.g., my_service):"
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if $ESCALATION_TOOL systemctl disable "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
|
||||||
echo "Service $SERVICE_NAME has been enabled."
|
echo "Service $SERVICE_NAME has been enabled."
|
||||||
else
|
else
|
||||||
echo "Failed to enable service: $SERVICE_NAME."
|
echo "Failed to enable service: $SERVICE_NAME."
|
||||||
|
@ -227,11 +227,11 @@ create_service_from_external() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the modified service file to /etc/systemd/system/
|
# Copy the modified service file to /etc/systemd/system/
|
||||||
$ESCALATION_TOOL cp "$SERVICE_FILE" "$SYSTEMD_SERVICE_FILE"
|
"$ESCALATION_TOOL" cp "$SERVICE_FILE" "$SYSTEMD_SERVICE_FILE"
|
||||||
|
|
||||||
# Set permissions and reload systemd
|
# Set permissions and reload systemd
|
||||||
$ESCALATION_TOOL chmod 644 "$SYSTEMD_SERVICE_FILE"
|
"$ESCALATION_TOOL" chmod 644 "$SYSTEMD_SERVICE_FILE"
|
||||||
$ESCALATION_TOOL systemctl daemon-reload
|
"$ESCALATION_TOOL" systemctl daemon-reload
|
||||||
echo "Service $SERVICE_NAME has been created and is ready to be started."
|
echo "Service $SERVICE_NAME has been created and is ready to be started."
|
||||||
|
|
||||||
# Optionally, enable and start the service
|
# Optionally, enable and start the service
|
||||||
|
@ -239,8 +239,8 @@ create_service_from_external() {
|
||||||
read -r START_ENABLE
|
read -r START_ENABLE
|
||||||
|
|
||||||
if [ "$START_ENABLE" = "y" ]; then
|
if [ "$START_ENABLE" = "y" ]; then
|
||||||
$ESCALATION_TOOL systemctl start "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||||
$ESCALATION_TOOL systemctl enable "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||||
echo "Service $SERVICE_NAME has been started and enabled."
|
echo "Service $SERVICE_NAME has been started and enabled."
|
||||||
else
|
else
|
||||||
echo "Service $SERVICE_NAME has been created but not started."
|
echo "Service $SERVICE_NAME has been created but not started."
|
||||||
|
|
|
@ -8,13 +8,13 @@ setupNetworkManager() {
|
||||||
if ! command_exists nmcli; then
|
if ! command_exists nmcli; then
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
pacman)
|
pacman)
|
||||||
$ESCALATION_TOOL "$PACKAGER" -S --noconfirm networkmanager
|
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm networkmanager
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y NetworkManager-1
|
"$ESCALATION_TOOL" "$PACKAGER" install -y NetworkManager-1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$ESCALATION_TOOL "$PACKAGER" install -y network-manager
|
"$ESCALATION_TOOL" "$PACKAGER" install -y network-manager
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -24,7 +24,7 @@ setupNetworkManager() {
|
||||||
# Check if NetworkManager service is running
|
# 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
|
||||||
|
|
||||||
if systemctl is-active --quiet NetworkManager; then
|
if systemctl is-active --quiet NetworkManager; then
|
||||||
printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}"
|
printf "%b\n" "${GREEN}NetworkManager service started successfully.${RC}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user