2024-09-20 05:01:43 +01:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
. ../common-script.sh
|
|
|
|
|
|
|
|
installLinutil() {
|
|
|
|
printf "%b\n" "${YELLOW}Installing Linutil...${RC}"
|
|
|
|
case "$PACKAGER" in
|
|
|
|
pacman)
|
|
|
|
printf "%b\n" "-----------------------------------------------------"
|
|
|
|
printf "%b\n" "Select the package to install:"
|
|
|
|
printf "%b\n" "1. ${CYAN}linutil${RC} (stable release compiled from source)"
|
|
|
|
printf "%b\n" "2. ${CYAN}linutil-bin${RC} (stable release pre-compiled)"
|
|
|
|
printf "%b\n" "3. ${CYAN}linutil-git${RC} (compiled from the latest commit)"
|
|
|
|
printf "%b\n" "-----------------------------------------------------"
|
|
|
|
printf "%b" "Enter your choice: "
|
|
|
|
read -r choice
|
|
|
|
case $choice in
|
2024-09-30 21:50:14 +01:00
|
|
|
1) "$AUR_HELPER" -S --needed --noconfirm linutil ;;
|
|
|
|
2) "$AUR_HELPER" -S --needed --noconfirm linutil-bin ;;
|
|
|
|
3) "$AUR_HELPER" -S --needed --noconfirm linutil-git ;;
|
2024-09-20 05:01:43 +01:00
|
|
|
*)
|
|
|
|
printf "%b\n" "${RED}Invalid choice:${RC} $choice"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
|
|
|
;;
|
2024-10-15 07:41:17 +01:00
|
|
|
zypper)
|
2024-10-16 02:03:08 +01:00
|
|
|
printf '%s\n' 'detecting flavor'
|
2024-10-16 02:17:37 +01:00
|
|
|
if zypper lr | grep -Fq Tumbleweed
|
|
|
|
then flavor=Tumbleweed
|
|
|
|
else flavor=Slowroll
|
|
|
|
fi
|
|
|
|
|
2024-10-16 02:03:08 +01:00
|
|
|
printf '%b%s%b\n' "flavor detected is ${GREEN}" "$flavor" "$RC"
|
2024-10-16 02:05:46 +01:00
|
|
|
printf "\n" "setting up repos"
|
2024-10-16 02:17:37 +01:00
|
|
|
if [ "$flavor" = Tumbleweed ]
|
2024-10-15 07:41:17 +01:00
|
|
|
then
|
2024-10-16 01:50:41 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" --gpg-auto-import-keys addrepo https://download.opensuse.org/repositories/home:solomoncyj/openSUSE_Tumbleweed/home:solomoncyj.repo
|
2024-10-15 07:41:17 +01:00
|
|
|
fi
|
|
|
|
|
2024-10-16 02:17:37 +01:00
|
|
|
if [ "$flavor" = Slowroll ]
|
2024-10-15 07:41:17 +01:00
|
|
|
then
|
2024-10-16 01:59:51 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" --gpg-auto-import-keys addrepo https://download.opensuse.org/repositories/home:solomoncyj/openSUSE_Slowroll/home:solomoncyj.repo
|
2024-10-15 07:41:17 +01:00
|
|
|
fi
|
|
|
|
|
2024-10-16 02:03:08 +01:00
|
|
|
printf '%s\n' 'refreshing and installing'
|
2024-10-16 01:05:17 +01:00
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" install linutil
|
2024-10-15 07:41:17 +01:00
|
|
|
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
|
|
|
;;
|
2024-09-20 05:01:43 +01:00
|
|
|
*)
|
|
|
|
printf "%b\n" "${RED}There are no official packages for your distro.${RC}"
|
2024-09-22 17:01:10 +01:00
|
|
|
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}"
|
2024-09-20 05:01:43 +01:00
|
|
|
read -r choice
|
|
|
|
case $choice in
|
|
|
|
y|Y)
|
|
|
|
if ! command_exists cargo; then
|
|
|
|
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
|
|
|
|
case "$PACKAGER" in
|
|
|
|
pacman)
|
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
|
|
|
|
;;
|
2024-09-28 19:52:51 +01:00
|
|
|
dnf)
|
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
|
|
|
|
;;
|
2024-09-20 05:01:43 +01:00
|
|
|
zypper)
|
|
|
|
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
2024-09-28 19:52:51 +01:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2024-09-20 05:01:43 +01:00
|
|
|
. $HOME/.cargo/env
|
|
|
|
;;
|
|
|
|
*)
|
2024-09-28 19:52:51 +01:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
|
|
. $HOME/.cargo/env
|
2024-09-20 05:01:43 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
rustup default stable
|
|
|
|
cargo install --force linutil_tui
|
|
|
|
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
|
|
|
;;
|
|
|
|
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
checkEnv
|
|
|
|
checkEscalationTool
|
|
|
|
checkAURHelper
|
2024-09-28 19:52:51 +01:00
|
|
|
installLinutil
|