代码拉取完成,页面将自动刷新
#!/usr/bin/env bash
set -e
GIT_BRANCH="master"
GIT_URL="https://gitee.com/spz2020_admin/shpkg-install-mirrors/raw/${GIT_BRANCH}"
# check for operating system (android)
if [ -e /system/bin/app_process ]; then
INSTALL_DIR="/data/data/com.termux/files/usr/bin"
DISTRO="android"
SUDO=""
else
INSTALL_DIR="/usr/local/bin"
DISTRO="linux"
if [ "$(id -u)" == "0" ]; then
SUDO=""
else
SUDO="sudo -Es"
fi
fi
DEBIAN_INSTALL_DEPS="git curl unzip xz-utils"
NON_DEBIAN_INSTALL_DEPS="git curl unzip xz"
# install deps
${SUDO} bash -c \
"apt install ${DEBIAN_INSTALL_DEPS} || pacman -S ${NON_DEBIAN_INSTALL_DEPS} --needed \
|| dnf install ${NON_DEBIAN_INSTALL_DEPS} || apk add ${NON_DEBIAN_INSTALL_DEPS}" 2> /dev/null
# setup repository lists (if possible)
if [ ! -e "${HOME}/.config/shpkg_repo.list" ]; then
mkdir -p "${HOME}/.config"
# initialize EOM heredoc by filling repo
if [ "${DISTRO}" == "android" ]; then
cat <<-EOM >> "${HOME}/.config/shpkg_repo.list"
# repository list for shpkg
# supported types are direct tarball download (zip or tar) or git url
# e.g.:
# https://github.com/shpkg/ports.git
# strip:https://github.com/shpkg/ports/archive/refs/heads/master.zip
#
# specify strip: if the tarball containing buildscript uses subdirectories
https://github.com/shpkg/termux-ports.git
EOM
else
cat <<-EOM >> "${HOME}/.config/shpkg_repo.list"
# repository list for shpkg
# supported types are direct tarball download (zip or tar) or git url
# e.g.:
# https://github.com/shpkg/ports.git
# strip:https://github.com/shpkg/ports/archive/refs/heads/master.zip
#
# specify strip: if the tarball containing buildscript uses subdirectories
https://github.com/shpkg/ports.git
EOM
fi
fi
# install script
${SUDO} curl --location "${GIT_URL}/shpkg" --output "${INSTALL_DIR}/shpkg"
${SUDO} chmod 755 "${INSTALL_DIR}/shpkg"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。