Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(installer, updater): formatting & small fixes #956

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions core/tabs/applications-setup/linutil-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,33 @@ installLinutil() {
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}"
read -r choice
case $choice in
y|Y)
y | Y)
if ! command_exists cargo; then
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm curl rustup man-db
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
rustup-init -y
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add build-base
"$ESCALATION_TOOL" "$PACKAGER" add rustup
rustup-init
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
"$ESCALATION_TOOL" "$PACKAGER" add build-base rustup
rustup-init -y
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. $HOME/.cargo/env
;;
esac
fi
rustup default stable
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
cargo install --force linutil_tui
printf "%b\n" "${GREEN}Installed successfully.${RC}"
installExtra
;;
*) printf "%b\n" "${RED}Linutil not installed.${RC}" ;;
esac
;;
esac
}

Expand Down
44 changes: 23 additions & 21 deletions core/tabs/applications-setup/linutil-updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,31 @@ updateLinutil() {

if ! command_exists cargo; then
printf "%b\n" "${YELLOW}Installing rustup...${RC}"
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. $HOME/.cargo/env
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add build-base
"$ESCALATION_TOOL" "$PACKAGER" add rustup
rustup-init
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y rustup
;;
esac
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rustup
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl rustup man-pages man-db man
rustup-init -y
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make rustup
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" add build-base rustup
rustup-init -y
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
;;
esac
fi

# shellcheck disable=SC1091
. "$HOME/.cargo/env"
rustup default stable

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[^"]+')

Expand All @@ -41,7 +44,6 @@ updateLinutil() {
fi

printf "%b\n" "${YELLOW}Updating linutil_tui...${RC}"
rustup default stable
cargo install --force linutil_tui
printf "%b\n" "${GREEN}Updated successfully.${RC}"
}
Expand Down