Skip to content

Commit

Permalink
update is now Termux-aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudxain authored May 12, 2024
1 parent ada8fa5 commit 70450b7
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions bin/update
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
#!/bin/sh
set -euf

# should it be uncommented?
#pkg upgrade # Termux

# should I use apt-get?
# "unstable API" doesn't seem to matter here
if apt update && apt upgrade
then
apt autoclean || true
apt autopurge || true

# https://github.com/pypa/pip/issues/4551

# if `apt` fails,
# it's likely `npm` will also fail
npm update -g || true # for LSPs
if [ -z "${TERMUX_VERSION:-}" ]; then
# should I use apt-get?
# "unstable API" doesn't seem to matter here
if apt update && apt upgrade
then
apt autoclean || true
apt autopurge || true

# https://github.com/pypa/pip/issues/4551

# if `apt` fails,
# it's likely `npm` will also fail
npm update -g || true # for LSPs
fi

rustup upgrade
crates="$(\
cargo install --list |\
# assume stable Cargo API
grep -E '^[a-z0-9_-]+ v[0-9.]+:$' |\
cut -f1 -d' ' \
)"
[ -n "$crates" ] && cargo install $crates
else
# https://wiki.termux.com/wiki/Package_Management
if pkg upgrade; then
# I have backups, no worries
pkg autoclean || true
apt autopurge || true

npm update -g || true # for LSPs
fi
fi

rustup upgrade
crates="$(\
cargo install --list |\
# assume stable Cargo API
grep -E '^[a-z0-9_-]+ v[0-9.]+:$' |\
cut -f1 -d' ' \
)"
[ -n "$crates" ] && cargo install $crates

0 comments on commit 70450b7

Please sign in to comment.