From 7833bbf7de0958551831b584464f67e4af3f6a1b Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Wed, 3 Nov 2021 19:48:05 +0800 Subject: feat(script): Optimize GPG key import Signed-off-by: KunoiSayami --- deploy.sh | 9 ++++++++- docker/dockerfile | 2 +- pkgbuild.sh | 10 +++++++++- repo/.gpg_keys/linux-zen-x86-64-v3 | 4 +--- repo/.gpg_keys/qemu-user-static | 4 +--- repo/.verified_repos | 5 ++++- repo/linux-zen-x86-64-v3/PKGBUILD | 4 ++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/deploy.sh b/deploy.sh index 045e03f..d380b76 100755 --- a/deploy.sh +++ b/deploy.sh @@ -7,5 +7,12 @@ if [ $# -eq 0 ]; then echo 'Should provide least one argument' exit 1 fi + +if [ -z ${SSH_CLIENT+x} ]; then + ADDITIONAL_PARAM="-Pv" +else + ADDITIONAL_PARAM="" +fi + /usr/bin/date +%s > "packages/LASTSYNC" -/usr/bin/rsync --partial -r -c --update --links --delete --exclude=.gitignore "packages/" $1:/var/www/repo/ +/usr/bin/rsync --partial $ADDITIONAL_PARAM -r -c --update --links --delete --exclude=.gitignore "packages/" $1:/var/www/repo/ diff --git a/docker/dockerfile b/docker/dockerfile index 87fe5d1..26b7e49 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,6 +1,6 @@ FROM repobuildbase:latest -RUN echo -e "\n[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$$arch\n" >> /etc/pacman.conf +RUN echo -e '\n[archlinuxcn]\nServer = https://repo.archlinuxcn.org/$arch\n' >> /etc/pacman.conf RUN pacman-key --init diff --git a/pkgbuild.sh b/pkgbuild.sh index 39718bb..9e1e3ae 100755 --- a/pkgbuild.sh +++ b/pkgbuild.sh @@ -63,6 +63,11 @@ if [ $# -gt 0 ] && [ "$1" = "--diff" ]; then exit 0 fi +if [ "$EUID" -eq 0 ] ; then + echo "\033[0;32mPlease run this script as non-root\033[0m" + exit 3 +fi + if [ $# -gt 0 ] && [ "$1" = "--all" ] || [ -n "$CI_COMMIT_TITLE" ] && [[ $CI_COMMIT_TITLE =~ fix\(repo\)|REBUILD ]]; then if [ -z "${FORCE_ALL+x}" ] || [ -n "$CI_COMMIT_TITLE" ] && [[ $CI_COMMIT_TITLE =~ REBUILD(\ |_)ALL ]]; then SKIP_VERIFIED=0 @@ -86,7 +91,8 @@ while read FOLDER_NAME ; do continue fi - if [ $SKIP_VERIFIED -eq 1 ] && grep -Fxq "$FOLDER_NAME" "../.verified_repos"; then + if [ -n "$CI_COMMIT_TITLE" ] && [[ $CI_COMMIT_TITLE =~ fix\(repo\)|REBUILD ]] && \ + [ $SKIP_VERIFIED -eq 1 ] && grep -Fxq "$FOLDER_NAME" "../.verified_repos"; then popd continue fi @@ -106,6 +112,8 @@ while read FOLDER_NAME ; do if [ -r ../.gpg_keys/"$FOLDER_NAME" ]; then . ../.gpg_keys/"$FOLDER_NAME" + gpg --list-keys --fingerprint |grep pub -A 1|grep -Ev "pub|--"|tr -d ' ' \ + | awk 'BEGIN { FS = "\n" } ; { print $1":6:" } ' | gpg --import-ownertrust fi hook "$FOLDER_NAME" diff --git a/repo/.gpg_keys/linux-zen-x86-64-v3 b/repo/.gpg_keys/linux-zen-x86-64-v3 index 372a7d0..1d2b8f5 100755 --- a/repo/.gpg_keys/linux-zen-x86-64-v3 +++ b/repo/.gpg_keys/linux-zen-x86-64-v3 @@ -37,6 +37,4 @@ iw1w/DBOYwD/Q1hlRq443eYpCO67W603mQhQFgRvGhmkqhhAEiOhX5gA/1Bxhr1m opmol4iQla74OApQ9CP3mnjgHWcRUTacAB8L =aIqj -----END PGP PUBLIC KEY BLOCK----- -EOF -gpg --list-keys --fingerprint |grep pub -A 1|grep -Ev "pub|--"|tr -d ' ' \ - | awk 'BEGIN { FS = "\n" } ; { print $1":6:" } ' | gpg --import-ownertrust \ No newline at end of file +EOF \ No newline at end of file diff --git a/repo/.gpg_keys/qemu-user-static b/repo/.gpg_keys/qemu-user-static index f098694..af11c08 100644 --- a/repo/.gpg_keys/qemu-user-static +++ b/repo/.gpg_keys/qemu-user-static @@ -60,6 +60,4 @@ Qd0aZoLwJ7ntrWeMxOkbf8950vPVxemQ1frblB0zR98fuUNhX4cjrFTI9iJck7xL UwNZfgOz9PodfqUv4riMLczMmw3nwGZO/aJg0m6uWSWk =7vDu -----END PGP PUBLIC KEY BLOCK----- -EOF -gpg --list-keys --fingerprint |grep pub -A 1|grep -Ev "pub|--"|tr -d ' ' \ - | awk 'BEGIN { FS = "\n" } ; { print $1":6:" } ' | gpg --import-ownertrust \ No newline at end of file +EOF \ No newline at end of file diff --git a/repo/.verified_repos b/repo/.verified_repos index 6745e7f..9ed10f5 100644 --- a/repo/.verified_repos +++ b/repo/.verified_repos @@ -2,4 +2,7 @@ chisel telegram-bot-api r8125-dkms pam_ssh_agent_auth_patched -mozjpeg \ No newline at end of file +mozjpeg +linux-zen-x86-64-v3 +glib2-static +qemu-user-static \ No newline at end of file diff --git a/repo/linux-zen-x86-64-v3/PKGBUILD b/repo/linux-zen-x86-64-v3/PKGBUILD index b02120b..3e3f7fa 100644 --- a/repo/linux-zen-x86-64-v3/PKGBUILD +++ b/repo/linux-zen-x86-64-v3/PKGBUILD @@ -61,8 +61,8 @@ prepare() { build() { cd $_srcname - make all - make htmldocs + make -j $(nproc) all + make -j $(nproc) htmldocs } _package() { -- cgit v1.3.1