mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-01-31 06:35:41 +00:00
Void
This commit is contained in:
parent
d91a44efab
commit
e44b900c0e
|
@ -15,6 +15,9 @@ installMeld() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add meld
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y meld
|
||||
;;
|
||||
*)
|
||||
checkFlatpak
|
||||
flatpak install -y flathub org.gnome.meld
|
||||
|
|
|
@ -32,6 +32,9 @@ installNeovim() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add neovim ripgrep fzf py3-virtualenv luarocks go shellcheck git
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y neovim ripgrep fzf python3-virtualenv luarocks go shellcheck git
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -28,6 +28,9 @@ installVsCode() {
|
|||
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
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y vscode
|
||||
;;
|
||||
apk)
|
||||
checkFlatpak
|
||||
flatpak install -y flathub com.visualstudio.code
|
||||
|
|
|
@ -12,6 +12,9 @@ installAlacritty() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add alacritty
|
||||
;;
|
||||
bps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y alacritty
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
|
||||
;;
|
||||
|
|
|
@ -18,6 +18,9 @@ install_adb() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add android-tools
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y android-tools
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -12,6 +12,9 @@ if ! command_exists chromium; then
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add chromium
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y chromium
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium
|
||||
;;
|
||||
|
|
|
@ -18,6 +18,9 @@ installFirefox() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y firefox
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add firefox
|
||||
;;
|
||||
|
|
|
@ -32,6 +32,10 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
|
|||
pacman)
|
||||
"$AUR_HELPER" -S --needed --noconfirm librewolf-bin
|
||||
;;
|
||||
xbps-install)
|
||||
printf '%s\n' 'repository=https://github.com/index-0/librewolf-void/releases/latest/download/' | "$ESCALATION_TOOL" tee /etc/xbps.d/20-librewolf.conf > /dev/null
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Syu librewolf
|
||||
;;
|
||||
apk)
|
||||
checkFlatpak
|
||||
flatpak install flathub io.gitlab.librewolf-community
|
||||
|
|
|
@ -12,6 +12,9 @@ installLynx() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add lynx
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y lynx
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y lynx
|
||||
;;
|
||||
|
|
|
@ -18,6 +18,9 @@ installTorBrowser() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y torbrowser-launcher
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y torbrowser-launcher
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -20,6 +20,9 @@ installDiscord() {
|
|||
"$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
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y Signal-Desktop
|
||||
;;
|
||||
apk)
|
||||
checkFlatpak
|
||||
flatpak install -y flathub com.discordapp.Discord
|
||||
|
|
|
@ -23,6 +23,9 @@ installSignal() {
|
|||
checkFlatpak
|
||||
flatpak install -y flathub org.signal.Signal
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y Signal-Desktop
|
||||
;;
|
||||
apk)
|
||||
checkFlatpak
|
||||
flatpak install -y flathub org.signal.Signal
|
||||
|
|
|
@ -12,6 +12,9 @@ installTelegram() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add telegram-desktop
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y telegram-desktop
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y telegram-desktop
|
||||
;;
|
||||
|
|
|
@ -12,6 +12,9 @@ installThunderBird() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add thunderbird
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y thunderbird
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y thunderbird
|
||||
;;
|
||||
|
|
|
@ -46,6 +46,9 @@ install_docker() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add docker
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y docker
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
@ -80,6 +83,9 @@ install_docker_compose() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add docker-cli-compose
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y docker-compose
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -17,6 +17,9 @@ installFastfetch() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add fastfetch
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y fastfetch
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
|
||||
;;
|
||||
|
|
|
@ -12,6 +12,9 @@ installKitty() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add kitty
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y kitty
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y kitty
|
||||
;;
|
||||
|
|
|
@ -14,6 +14,9 @@ installDepend() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add bash bash-completion tar bat tree unzip fontconfig git
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y bash bash-completion tar bat tree unzip fontconfig git
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
||||
;;
|
||||
|
|
|
@ -19,6 +19,9 @@ installLibreOffice() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add libreoffice
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y libreoffice
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -12,6 +12,9 @@ installEvince() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add evince
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y evince
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y evince
|
||||
;;
|
||||
|
|
|
@ -12,6 +12,9 @@ installOkular() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add okular
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y okular
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y okular
|
||||
;;
|
||||
|
|
|
@ -18,6 +18,9 @@ installPodmanCompose() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman-compose
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y podman-compose
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -18,6 +18,9 @@ installPodman() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y podman
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y podman
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -12,6 +12,9 @@ installRofi() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add rofi
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y rofi
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y rofi
|
||||
;;
|
||||
|
|
|
@ -13,6 +13,9 @@ installZsh() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add zsh
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y zsh
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y zsh
|
||||
;;
|
||||
|
|
|
@ -12,6 +12,9 @@ installPkg() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add ufw
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y ufw
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y ufw
|
||||
;;
|
||||
|
|
|
@ -40,6 +40,13 @@ installDepend() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add build-base multitail tar tree trash-cli unzip cmake jq
|
||||
;;
|
||||
xbps-install)
|
||||
COMPILEDEPS='base-devel'
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y $DEPENDENCIES $COMPILEDEPS
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y void-repo-multilib
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sy
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y glibc-32bit gcc-multilib
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||
;;
|
||||
|
|
|
@ -17,6 +17,9 @@ install_theme_tools() {
|
|||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y qt6ct kvantum
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -27,6 +27,9 @@ cleanup_system() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" cache clean
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" xbps-remove -Oo
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
|
||||
;;
|
||||
|
|
|
@ -56,6 +56,9 @@ fastUpdate() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" xbps-install -S
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
@ -82,6 +85,9 @@ updateSystem() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" upgrade
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Su
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -16,6 +16,9 @@ InstallTermiusFonts() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y terminus-fonts-console
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y terminus-font
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
@ -28,7 +31,7 @@ InstallTermiusFonts() {
|
|||
|
||||
SetTermiusFonts() {
|
||||
case "$DTYPE" in
|
||||
arch)
|
||||
arch|fedora|void)
|
||||
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
|
@ -50,14 +53,6 @@ SetTermiusFonts() {
|
|||
fi
|
||||
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||
;;
|
||||
fedora)
|
||||
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
"$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ setupBluetooth() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add bluez
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y bluez
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y bluez
|
||||
;;
|
||||
|
|
|
@ -22,6 +22,9 @@ if ! command_exists openssl; then
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add openssl
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y openssl
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -9,11 +9,11 @@ installCUPS() {
|
|||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm cups
|
||||
;;
|
||||
apt-get | nala)
|
||||
apt-get|nala|dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y cups
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y cups
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y cups
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}"
|
||||
|
|
|
@ -16,6 +16,9 @@ installEpsonPrinterDriver() {
|
|||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y epson-inkjet-printer-escpr
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y epson-inkjet-printer-escpr
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager ${PACKAGER}${RC}"
|
||||
exit 1
|
||||
|
|
|
@ -14,6 +14,9 @@ install_package() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add "$PACKAGE"
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y "$PACKAGE"
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE"
|
||||
;;
|
||||
|
@ -41,6 +44,10 @@ setup_ssh() {
|
|||
install_package openssh
|
||||
SSH_SERVICE="sshd"
|
||||
;;
|
||||
xbps-install)
|
||||
install_package openssh
|
||||
SSH_SERVICE="sshd"
|
||||
;;
|
||||
*)
|
||||
install_package openssh-server
|
||||
SSH_SERVICE="sshd"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Load common script functions
|
||||
# Load common script functions and service functions
|
||||
. ../common-script.sh
|
||||
. ../common-service-script.sh
|
||||
|
||||
#external services directory
|
||||
SCRIPT_DIR="./services"
|
||||
|
@ -29,25 +30,67 @@ show_menu() {
|
|||
# Function to view all services
|
||||
view_all_services() {
|
||||
printf "%b\n" "Listing all services..."
|
||||
case "$INIT_MANAGER" in
|
||||
systemctl)
|
||||
"$ESCALATION_TOOL" systemctl list-units --type=service --all --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||
;;
|
||||
rc-service)
|
||||
"$ESCALATION_TOOL" rc-update show | more
|
||||
;;
|
||||
runit)
|
||||
ls -1 /etc/sv/ | more
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to view enabled services
|
||||
view_enabled_services() {
|
||||
printf "%b\n" "Listing enabled services..."
|
||||
case "$INIT_MANAGER" in
|
||||
systemctl)
|
||||
"$ESCALATION_TOOL" systemctl list-unit-files --type=service --state=enabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||
;;
|
||||
rc-service)
|
||||
"$ESCALATION_TOOL" rc-update show -v | grep "\[" | more
|
||||
;;
|
||||
runit)
|
||||
ls -1 /var/service/ | more
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to view disabled services
|
||||
view_disabled_services() {
|
||||
printf "%b\n" "Listing disabled services..."
|
||||
case "$INIT_MANAGER" in
|
||||
systemctl)
|
||||
"$ESCALATION_TOOL" systemctl list-unit-files --type=service --state=disabled --no-legend | awk '{print $1}' | sed 's/\.service//' | more
|
||||
;;
|
||||
rc-service)
|
||||
"$ESCALATION_TOOL" rc-update show -v | grep -v "\[" | more
|
||||
;;
|
||||
runit)
|
||||
ls -1 /etc/sv/ | grep -v "$(ls -1 /var/service/)" | more
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to view started services
|
||||
view_started_services() {
|
||||
printf "%b\n" "Listing started services: "
|
||||
printf "%b\n" "Listing started services..."
|
||||
case "$INIT_MANAGER" in
|
||||
systemctl)
|
||||
"$ESCALATION_TOOL" systemctl list-units --type=service --state=running --no-pager | head -n -6 | awk 'NR>1 {print $1}' | more
|
||||
;;
|
||||
rc-service)
|
||||
"$ESCALATION_TOOL" rc-status --servicelist | more
|
||||
;;
|
||||
runit)
|
||||
for service in /var/service/*; do
|
||||
[ -d "$service" ] && "$ESCALATION_TOOL" sv status "$(basename "$service")" | grep "^run:" >/dev/null && basename "$service"
|
||||
done | more
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to add a new service
|
||||
|
@ -104,8 +147,7 @@ add_service() {
|
|||
read -r START_ENABLE
|
||||
|
||||
if [ "$START_ENABLE" = "y" ] || [ "$START_ENABLE" = "Y" ]; then
|
||||
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||
startAndEnableService "$SERVICE_NAME"
|
||||
printf "%b\n" "Service $SERVICE_NAME has been started and enabled."
|
||||
else
|
||||
printf "%b\n" "Service $SERVICE_NAME has been created but not started."
|
||||
|
@ -117,20 +159,42 @@ remove_service() {
|
|||
printf "%b" "Enter the name of the service to remove (e.g., my_service): "
|
||||
read -r SERVICE_NAME
|
||||
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
||||
|
||||
if [ -f "$SERVICE_FILE" ]; then
|
||||
if isServiceActive "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Stopping and disabling the service..."
|
||||
"$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"
|
||||
"$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"
|
||||
stopService "$SERVICE_NAME"
|
||||
disableService "$SERVICE_NAME"
|
||||
fi
|
||||
|
||||
printf "%b\n" "Removing the service file..."
|
||||
case "$INIT_MANAGER" in
|
||||
systemctl)
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
||||
if [ -f "$SERVICE_FILE" ]; then
|
||||
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
|
||||
"$ESCALATION_TOOL" systemctl daemon-reload
|
||||
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
||||
else
|
||||
printf "%b\n" "Service $SERVICE_NAME does not exist."
|
||||
fi
|
||||
;;
|
||||
rc-service)
|
||||
SERVICE_FILE="/etc/init.d/$SERVICE_NAME"
|
||||
if [ -f "$SERVICE_FILE" ]; then
|
||||
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
|
||||
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
||||
else
|
||||
printf "%b\n" "Service $SERVICE_NAME does not exist."
|
||||
fi
|
||||
;;
|
||||
runit)
|
||||
SERVICE_DIR="/etc/sv/$SERVICE_NAME"
|
||||
if [ -d "$SERVICE_DIR" ]; then
|
||||
"$ESCALATION_TOOL" rm -rf "$SERVICE_DIR"
|
||||
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
||||
else
|
||||
printf "%b\n" "Service $SERVICE_NAME does not exist."
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to start a service
|
||||
|
@ -139,7 +203,7 @@ start_service() {
|
|||
printf "%b" "Enter the name of the service to start (e.g., my_service): "
|
||||
read -r SERVICE_NAME
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
|
||||
if startService "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Service $SERVICE_NAME has been started."
|
||||
else
|
||||
printf "%b\n" "Failed to start service: $SERVICE_NAME."
|
||||
|
@ -152,7 +216,7 @@ stop_service() {
|
|||
printf "%b" "Enter the name of the service to stop (e.g., my_service): "
|
||||
read -r SERVICE_NAME
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
|
||||
if stopService "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Service $SERVICE_NAME has been stopped."
|
||||
else
|
||||
printf "%b\n" "Failed to stop service: $SERVICE_NAME."
|
||||
|
@ -165,29 +229,28 @@ enable_service() {
|
|||
printf "%b" "Enter the name of the service to enable (e.g., my_service): "
|
||||
read -r SERVICE_NAME
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
|
||||
if enableService "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Service $SERVICE_NAME has been enabled."
|
||||
else
|
||||
printf "%b\n" "Failed to enable service: $SERVICE_NAME."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to enable a service
|
||||
# Function to disable a service
|
||||
disable_service() {
|
||||
view_enabled_services
|
||||
printf "%b" "Enter the name of the service to disable (e.g., my_service): "
|
||||
read -r SERVICE_NAME
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Service $SERVICE_NAME has been enabled."
|
||||
if disableService "$SERVICE_NAME"; then
|
||||
printf "%b\n" "Service $SERVICE_NAME has been disabled."
|
||||
else
|
||||
printf "%b\n" "Failed to enable service: $SERVICE_NAME."
|
||||
printf "%b\n" "Failed to disable service: $SERVICE_NAME."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to create, start, and enable a service from an external service file
|
||||
# Function to create service from external
|
||||
create_service_from_external() {
|
||||
|
||||
# List all .service files in the SCRIPT_DIR
|
||||
printf "%b\n" "============================"
|
||||
printf "%b\n" "Listing available service files"
|
||||
|
@ -237,8 +300,7 @@ create_service_from_external() {
|
|||
read -r START_ENABLE
|
||||
|
||||
if [ "$START_ENABLE" = "y" ]; then
|
||||
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||
startAndEnableService "$SERVICE_NAME"
|
||||
printf "%b\n" "Service $SERVICE_NAME has been started and enabled."
|
||||
else
|
||||
printf "%b\n" "Service $SERVICE_NAME has been created but not started."
|
||||
|
|
|
@ -16,6 +16,9 @@ setup_xrandr() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add xrandr
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y xrandr
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-server-utils
|
||||
;;
|
||||
|
|
|
@ -17,6 +17,9 @@ setupNetworkManager() {
|
|||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add networkmanager-wifi iwd
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y NetworkManager iwd
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y network-manager
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue
Block a user