Skip to content

Commit

Permalink
优化流程
Browse files Browse the repository at this point in the history
# 91
  • Loading branch information
tossp committed Apr 10, 2022
1 parent 4357c38 commit df9a842
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ jobs:
- name: 检出项目文件
uses: actions/checkout@v2

# - name: 缓存加速
# uses: actions/cache@v2
# with:
# path: |
# cache/*.pat
# docker/downloads/*.txz
# key: ${{matrix.platform}}-${{matrix.version}}-${{ hashFiles('global_config.json') }}
- name: 缓存加速
uses: actions/cache@v2
with:
path: |
cache/*.pat
docker/downloads/*.txz
key: ${{matrix.platform}}-${{matrix.version}}-${{ hashFiles('global_config.json') }}

- name: 准备构建环境
run: |
Expand Down
16 changes: 8 additions & 8 deletions docker/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ pr_dbg "*******************************************"
# Args: $1 directory to unpack (must exist) | $2 file path | $3 should hard fail on error? [default=1]
brp_repack_tar()
{
pr_process "Unpacking %s file to %s" "${1}" "${2}"
pr_process "Repacking %s file form %s" "${2}" "${1}"

local output;
output=$("${TAR_PATH}" -czf "${1}" -C "${2}" 2>&1)
output=$("${TAR_PATH}" -czf "${2}" -C "${1}" . 2>&1)
if [ $? -ne 0 ]; then
pr_process_err

Expand Down Expand Up @@ -201,17 +201,16 @@ make_extract(){
pr_dbg "Found syno_extract_system_patch File at %s - skipping nake" "${extract_bin}"
fi

LD_LIBRARY_PATH=/usr/local/lib ${extract_bin} "${BRP_PAT_FILE}" /tmp/pat && pr_info "extract latest pat"
pr_process "Use syno_extract_system_patch extract PAT"
LD_LIBRARY_PATH=/usr/local/lib ${extract_bin} "${BRP_PAT_FILE}" /tmp/pat && pr_process_ok || pr_process_err

pr_process "Repacked PAT %s" ${BRP_PAT_FILE}
pr_empty_nl
pr_process "New checksum of PAT %s - Patch the PAT checksum" ${BRP_PAT_FILE}
brp_repack_tar "/tmp/pat" /tmp/repack.tar.gz
mv ${BRP_PAT_FILE} ${BRP_PAT_FILE}.org && mv /tmp/repack.tar.gz ${BRP_PAT_FILE} && rm -rf "/tmp/pat"

sum=`sha256sum ${BRP_PAT_FILE} | awk '{print $1}'`
old_sum="$(brp_json_get_field "${BRP_REL_CONFIG_JSON}" "os.sha256")"
# sed -i "s/${old_sum}/${sum}/" "${BRP_REL_CONFIG_JSON}"
pr_info "New checksum of PAT %s - Patch the PAT checksum" "${sum}"

pr_process_ok
}
Expand Down Expand Up @@ -246,6 +245,8 @@ check_pat() {
##########################################################
# fix redo
readonly BRP_PAT_FILE="${BRP_CACHE_DIR}/${BRP_REL_OS_ID}.pat"
readonly EXTRACT_PAT_FILE="${BRP_CACHE_DIR}/extract.tar.gz"
readonly EXTRACT_PAT_URL='https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3615xs_42218.pat'

if [ -f "${BRP_PAT_FILE}.org" ] && [ -f "${BRP_PAT_FILE}" ]; then
pr_info "Found patched PAT file - Patch the PAT checksum"
Expand All @@ -257,8 +258,6 @@ if [ -f "${BRP_PAT_FILE}.org" ] && [ -f "${BRP_PAT_FILE}" ]; then
fi
fi

readonly EXTRACT_PAT_FILE="${BRP_CACHE_DIR}/extract.tar.gz"
readonly EXTRACT_PAT_URL='https://global.download.synology.com/download/DSM/release/7.0.1/42218/DSM_DS3615xs_42218.pat'

if [ ! -d "${BRP_UPAT_DIR}" ]; then
pr_dbg "Unpacked PAT %s not found - preparing" "${BRP_UPAT_DIR}"
Expand All @@ -277,6 +276,7 @@ if [ ! -d "${BRP_UPAT_DIR}" ]; then
exec_status=$?
pr_info "Test encryption pat results %s" "${exec_status}"
if [ "$exec_status" -eq 1 ]; then
pr_empty_nl
make_extract "${BRP_PAT_FILE}"
fi
brp_unpack_tar "${BRP_PAT_FILE}" "${BRP_UPAT_DIR}"
Expand Down

0 comments on commit df9a842

Please sign in to comment.