mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-23 13:45:19 +00:00
Refact and fix linutil-updated, installer
Installer -> Remove unreachable pacman case. dnf requires rustup-init before using rustup-init. Source .cargo/env after the installation of rustup. Updater -> Formatting, Add dnf installation, change the wild case to use rustup.rs general installer from rust. Source the .cargo/env after the installation of rustup.
This commit is contained in:
parent
ab7a67087d
commit
903cdc7e7e
|
@ -34,36 +34,33 @@ 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
|
||||||
pacman)
|
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm curl rustup man-db
|
|
||||||
;;
|
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
|
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
|
||||||
|
rustup-init -y
|
||||||
;;
|
;;
|
||||||
apk)
|
apk)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add build-base
|
"$ESCALATION_TOOL" "$PACKAGER" add build-base rustup
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add rustup
|
rustup-init -y
|
||||||
rustup-init
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
. "$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
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
rustup default stable
|
rustup default stable
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
cargo install --force linutil_tui
|
cargo install --force linutil_tui
|
||||||
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
printf "%b\n" "${GREEN}Installed successfully.${RC}"
|
||||||
installExtra
|
installExtra
|
||||||
;;
|
;;
|
||||||
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
|
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,28 +10,31 @@ updateLinutil() {
|
||||||
|
|
||||||
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
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
|
||||||
;;
|
;;
|
||||||
zypper)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
rustup-init -y
|
||||||
. $HOME/.cargo/env
|
;;
|
||||||
;;
|
zypper)
|
||||||
apk)
|
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make rustup
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add build-base
|
;;
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add rustup
|
apk)
|
||||||
rustup-init
|
"$ESCALATION_TOOL" "$PACKAGER" add build-base rustup
|
||||||
# shellcheck disable=SC1091
|
rustup-init -y
|
||||||
. "$HOME/.cargo/env"
|
;;
|
||||||
;;
|
*)
|
||||||
*)
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
rustup default stable
|
||||||
|
|
||||||
INSTALLED_VERSION=$(cargo install --list | grep "linutil_tui" | awk '{print $2}' | tr -d 'v:')
|
INSTALLED_VERSION=$(cargo install --list | grep "linutil_tui" | awk '{print $2}' | tr -d 'v:')
|
||||||
LATEST_VERSION=$(curl -s https://crates.io/api/v1/crates/linutil_tui | grep -oP '"max_version":\s*"\K[^"]+')
|
LATEST_VERSION=$(curl -s https://crates.io/api/v1/crates/linutil_tui | grep -oP '"max_version":\s*"\K[^"]+')
|
||||||
|
|
||||||
|
@ -41,7 +44,6 @@ updateLinutil() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Updating linutil_tui...${RC}"
|
printf "%b\n" "${YELLOW}Updating linutil_tui...${RC}"
|
||||||
rustup default stable
|
|
||||||
cargo install --force linutil_tui
|
cargo install --force linutil_tui
|
||||||
printf "%b\n" "${GREEN}Updated successfully.${RC}"
|
printf "%b\n" "${GREEN}Updated successfully.${RC}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user