tools/checkrelease.sh: auto import KEYS from the release server
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
f91372c09d
commit
17bd5f3d1a
@ -23,6 +23,7 @@ RETURN_CODE=0
|
|||||||
|
|
||||||
BASE_URL="https://dist.apache.org/repos/dist/dev/incubator/nuttx"
|
BASE_URL="https://dist.apache.org/repos/dist/dev/incubator/nuttx"
|
||||||
TEMPDIR="/tmp/nuttx-checkrelease"
|
TEMPDIR="/tmp/nuttx-checkrelease"
|
||||||
|
KEY="$BASE_URL/KEYS"
|
||||||
|
|
||||||
function validate_url() {
|
function validate_url() {
|
||||||
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
|
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
|
||||||
@ -46,6 +47,17 @@ function download_release() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function import_key() {
|
||||||
|
if [[ $(validate_url "$KEY") ]]; then
|
||||||
|
export GNUPGHOME="$TEMPDIR/.gnupg"
|
||||||
|
wget -q -O- "$KEY" | gpg --import
|
||||||
|
echo " OK: $KEY is imported."
|
||||||
|
else
|
||||||
|
echo " - Error importing $KEY."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function check_sha512() {
|
function check_sha512() {
|
||||||
RELEASE_FILE=$1
|
RELEASE_FILE=$1
|
||||||
echo "Checking $RELEASE_FILE sha512..."
|
echo "Checking $RELEASE_FILE sha512..."
|
||||||
@ -150,7 +162,7 @@ function usage() {
|
|||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo
|
echo
|
||||||
echo " $0 --release 9.1.0-RC1"
|
echo " $0 --release 9.1.0-RC1"
|
||||||
echo " $0 --url https://dist.apache.org/repos/dist/dev/incubator/nuttx/9.1.0-RC1/"
|
echo " $0 --url https://dist.apache.org/repos/dist/dev/incubator/nuttx/9.1.0-RC1"
|
||||||
echo " $0 --dir ./some-dir-that-has-nuttx-and-apps"
|
echo " $0 --dir ./some-dir-that-has-nuttx-and-apps"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
@ -164,6 +176,7 @@ do
|
|||||||
-U|--url)
|
-U|--url)
|
||||||
shift
|
shift
|
||||||
URL="$1/"
|
URL="$1/"
|
||||||
|
KEY="$1/../KEYS"
|
||||||
;;
|
;;
|
||||||
-R|--release)
|
-R|--release)
|
||||||
shift
|
shift
|
||||||
@ -196,6 +209,7 @@ if [[ (-z "$URL") && (-z "$DIRECTORY") ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
download_release
|
download_release
|
||||||
|
import_key
|
||||||
check_nuttx
|
check_nuttx
|
||||||
check_nuttx_apps
|
check_nuttx_apps
|
||||||
check_sim_nsh_build
|
check_sim_nsh_build
|
||||||
|
Loading…
Reference in New Issue
Block a user