1 Star 0 Fork 0

me-Mirror../shpkg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
install.sh 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
spz2020 提交于 2021-08-14 09:11 . mirrors by Spz2020
#!/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"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/spz2020_admin/shpkg-install-mirrors.git
git@gitee.com:spz2020_admin/shpkg-install-mirrors.git
spz2020_admin
shpkg-install-mirrors
shpkg
master

搜索帮助

A270a887 8829481 3d7a4017 8829481