From ca87a72d3f0ffdd13f84f389a16b19f34b09626d Mon Sep 17 00:00:00 2001 From: pooneyy <85266337+pooneyy@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:29:39 +0800 Subject: [PATCH] Create update_local_appstore.sh --- update_local_appstore.sh | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 update_local_appstore.sh diff --git a/update_local_appstore.sh b/update_local_appstore.sh new file mode 100644 index 000000000..edfc1b038 --- /dev/null +++ b/update_local_appstore.sh @@ -0,0 +1,41 @@ +check_command() { + command -v "$1" > /dev/null 2>&1 || { + echo >&2 "未找到 $1 命令" + exit 1 + } +} + +check_command "cp" +check_command "cut" +check_command "git" +check_command "grep" +check_command "rm" +check_command "which" +check_command "xargs" + +BASE_DIR=$(which 1pctl | xargs grep '^BASE_DIR=' | cut -d'=' -f2) +if [ -z "$BASE_DIR" ]; then + echo "未找到 1panel 的安装路径" + exit 1 +fi + +TEMP_DIR="/tmp/localApps" + +repo_prefixs=( + 'https://github.com' + 'https://kkgithub.com' + 'https://wget.la/https://github.com' + 'https://ghfast.top/https://github.com' + 'https://githubfast.com' + 'https://ghproxy.net/https://github.com' +) + +repo_suffix="/pooneyy/1Panel-Appstore.git" + +for repo_prefix in "${repo_prefixs[@]}"; do + git clone --depth 1 -b localApps $repo_prefix$repo_suffix $TEMP_DIR && break +done + +cp -rf $TEMP_DIR/apps/* $BASE_DIR/1panel/resource/apps/local/ + +rm -rf $TEMP_DIR