Skip to content

Commit

Permalink
Add support for arch (LSPosed#556)
Browse files Browse the repository at this point in the history
* For Arch, confirm before any operation

---------

Co-authored-by: Howard Wu <[email protected]>
  • Loading branch information
faizauthar12 and Howard20181 authored May 25, 2023
1 parent 02862b2 commit 3d819b9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
9 changes: 5 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

The following dependencies are required:

| DistrOS | | | | |
|:-------------------:|--------------------------------------------------------------------------------|------------|--------------|--------------------|
| Debian | `lzip patchelf e2fsprogs python3 python3-pip aria2 p7zip-full attr unzip sudo` | `whiptail` | `qemu-utils` | `python3-venv` |
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` | `python3-venvctrl` |
| DistrOS | | | | | | |
|:-------------------:|---------------------------------------------------------|------------|--------------|--------------------|---------------|--------------|
| Debian | `lzip patchelf e2fsprogs python3 aria2 attr unzip sudo` | `whiptail` | `qemu-utils` | `python3-venv` | `python3-pip` | `p7zip-full` |
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` | `python3-venvctrl` | Same as above |
| Arch | Same as Debian | `libnewt` | `qemu-img` | Same as Debian | `python-pip` | `p7zip` |

The python3 library `requests` is used.

Expand Down
29 changes: 28 additions & 1 deletion scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ check_dependencies
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release)
declare -A os_pm_install
# os_pm_install["/etc/redhat-release"]=yum
# os_pm_install["/etc/arch-release"]=pacman
os_pm_install["/etc/arch-release"]=pacman
# os_pm_install["/etc/gentoo-release"]=emerge
os_pm_install["/etc/SuSE-release"]=zypper
os_pm_install["/etc/debian_version"]=apt-get
Expand Down Expand Up @@ -107,6 +107,22 @@ require_su
if [ -z "$PM" ]; then
echo "Unable to determine package manager: Unsupported distros"
abort
elif [ "$PM" = "pacman" ]; then
i=30
while ((i-- > 1)) &&
! read -r -sn 1 -t 1 -p $'\r:: Proceed with full system upgrade? Cancel after '$i$'s.. [y/N]\e[0K ' answer; do
:
done
[[ $answer == [yY] ]] && answer=Yes || answer=No
echo "$answer"
case "$answer" in
Yes)
if ! ($SUDO "$PM" "${UPDATE_OPTION[@]}" ca-certificates); then abort; fi
;;
*)
abort "Operation cancelled by user"
;;
esac
else
if ! ($SUDO "$PM" "${UPDATE_OPTION[@]}" && $SUDO "$PM" "${UPGRADE_OPTION[@]}" ca-certificates); then abort; fi
fi
Expand All @@ -127,6 +143,17 @@ if [ -n "${NEED_INSTALL[*]}" ]; then
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
readarray -td ' ' NEED_INSTALL <<<"${NEED_INSTALL_FIX//p7zip-full/p7zip} "
unset 'NEED_INSTALL[-1]'
elif [ "$PM" = "pacman" ]; then
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
{
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/libnewt} 2>&1
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//qemu-utils/qemu-img} 2>&1
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//python3-pip/python-pip} 2>&1
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//p7zip-full/p7zip} 2>&1
} >>/dev/null

readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX "
unset 'NEED_INSTALL[-1]'
fi
if ! ($SUDO "$PM" "${INSTALL_OPTION[@]}" "${NEED_INSTALL[@]}"); then abort; fi

Expand Down

0 comments on commit 3d819b9

Please sign in to comment.