diff --git a/.github/workflows/update-mirror.yml b/.github/workflows/update-mirror.yml index 265d2e6..baf598d 100644 --- a/.github/workflows/update-mirror.yml +++ b/.github/workflows/update-mirror.yml @@ -54,14 +54,6 @@ jobs: make download -j8 find dl -size -1024c -exec rm -f {} \; - - name: Fetch Cached Uploaded Files List - uses: actions/cache@v3 - with: - path: "uploaded-files" - key: immortalwrt-mirror-uploaded-${{ matrix.branch }}-${{ github.run_id }} - restore-keys: | - immortalwrt-mirror-uploaded- - - name: Fetch Cached Uploader Keys uses: actions/cache@v3 with: @@ -95,11 +87,10 @@ jobs: UPLOADER_TYPE: "onedrive" UPLOADER_CONF: "uploader.json" run: | - ./uploader-cache/detect-upload-files.sh - [ "$(ls -A "package-sources"/* | wc -l)" -gt "0" ] || exit 0 + mkdir -p package-sources + for i in $(cat "sourcelist"); do mv "immortalwrt/dl/$i" "package-sources/"; done [ -f "uploader-keys/$UPLOADER_TYPE.json" ] && cp -f "uploader-keys/$UPLOADER_TYPE.json" "$UPLOADER_CONF" || ./onedrive-uploader/gen-onedriveconf.sh ./onedrive-uploader/OneDriveUploader -f -c "$UPLOADER_CONF" -s "package-sources" -r "/" -skip - ./uploader-cache/gen-downloaded-hash.sh [ -d "uploader-keys" ] || mkdir -p "uploader-keys" cp -f "$UPLOADER_CONF" "uploader-keys/$UPLOADER_TYPE.json" diff --git a/uploader-cache/detect-upload-files.sh b/uploader-cache/detect-upload-files.sh deleted file mode 100755 index f6c40ac..0000000 --- a/uploader-cache/detect-upload-files.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2021 ImmortalWrt.org - -DL_PATH="immortalwrt/dl" -LIST_FILE="uploaded-files/$UPLOADER_TYPE.sha256sum" -SOURCE_DIR="package-sources" - -rm -rf "$SOURCE_DIR" -mkdir "$SOURCE_DIR" - -mkdir -p "uploaded-files" - -if [ "$(ls -A "$DL_PATH"/* | wc -l)" -gt "0" ]; then - for i in "$DL_PATH"/*; do - FILE_HASH="$(sha256sum "$i" | awk -F ' ' '{print $1}')" - if [ -f "$LIST_FILE" ]; then - FILE_CACHED_HASH="$(grep "$i" "$LIST_FILE" | awk -F ' ' '{print $1}')" - if [ "$FILE_CACHED_HASH" != "$FILE_HASH" ]; then - cp -fp "$i" "$SOURCE_DIR"/ - echo -e "Cached hash: $FILE_CACHED_HASH, now hash: $FILE_HASH" - echo -e "Refresh uploaded file: ${i##*/}" - # else - # echo -e "Skipped uploaded file: ${i##*/}" - fi - else - cp -fp "$i" "$SOURCE_DIR"/ - fi - done -else - echo -e "No files found." - exit 1 -fi diff --git a/uploader-cache/gen-downloaded-hash.sh b/uploader-cache/gen-downloaded-hash.sh deleted file mode 100755 index a0d9649..0000000 --- a/uploader-cache/gen-downloaded-hash.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2021 ImmortalWrt.org - -LIST_FILE="uploaded-files/$UPLOADER_TYPE.sha256sum" -SOURCE_DIR="package-sources" - -mkdir -p "uploaded-files" - -if [ "$(ls -A "$SOURCE_DIR"/* | wc -l)" -gt "0" ]; then - for i in "$SOURCE_DIR"/*; do - FILE_HASH_RESULT="$(sha256sum "$i")" - if [ -f "$LIST_FILE" ]; then - sed -i "/${i//\//\\/}/d" "$LIST_FILE" - echo -e "$FILE_HASH_RESULT" >> "$LIST_FILE" - else - echo -e "$FILE_HASH_RESULT" > "$LIST_FILE" - fi - done -else - echo -e "No files found." - exit 1 -fi - -rm -rf "$SOURCE_DIR" - -exit 0