sign-build: support signing multiple devices
Also make sure that the scripts find the signapk.jar. Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
This commit is contained in:
parent
8cb84ac243
commit
c57d61c790
48
sign-build
48
sign-build
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
DEVICE=$1
|
||||||
BASEDIR=$(pwd)
|
BASEDIR=$(pwd)
|
||||||
KEY_DIR=$BASEDIR/vendor/replicant-security
|
KEY_DIR=$BASEDIR/vendor/replicant-security
|
||||||
|
|
||||||
@ -38,7 +39,8 @@ else
|
|||||||
OUT_DIR=$OUT_DIR_COMMON_BASE/${PWD##*/}
|
OUT_DIR=$OUT_DIR_COMMON_BASE/${PWD##*/}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TARGET_FILES=$OUT_DIR/target/product/*/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip
|
TARGET_DIR=$OUT_DIR/target/product/$DEVICE
|
||||||
|
TARGET_FILES=$TARGET_DIR/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip
|
||||||
DIST_OUT_DIR=$OUT_DIR/"dist"
|
DIST_OUT_DIR=$OUT_DIR/"dist"
|
||||||
RELEASE=replicant-6.0
|
RELEASE=replicant-6.0
|
||||||
|
|
||||||
@ -73,34 +75,54 @@ generate_keys () {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$DEVICE" = "" ]
|
||||||
|
then
|
||||||
|
echo "Usage: $0 [DEVICE]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -d "$TARGET_DIR" ]
|
||||||
|
then
|
||||||
|
echo "The build directory for $DEVICE does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f $TARGET_FILES ]
|
||||||
|
then
|
||||||
|
echo "No files to sign. Make sure the build for $DEVICE completed successfully."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ -d "$KEY_DIR" ]
|
if ! [ -d "$KEY_DIR" ]
|
||||||
then
|
then
|
||||||
generate_keys
|
generate_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -f $TARGET_FILES ]
|
|
||||||
then
|
|
||||||
echo "You need to build before you can sign: make -j $(nproc) bacon"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $DIST_OUT_DIR
|
mkdir -p $DIST_OUT_DIR
|
||||||
|
|
||||||
# -o option replaces the test keys with the created ones
|
# -o option replaces the test keys with the created ones
|
||||||
|
# -p makes sure the script finds signapk.jar
|
||||||
python $BASEDIR/build/tools/releasetools/sign_target_files_apks \
|
python $BASEDIR/build/tools/releasetools/sign_target_files_apks \
|
||||||
-o \
|
-o \
|
||||||
|
-p $OUT_DIR/host/linux-x86 \
|
||||||
-d $KEY_DIR $TARGET_FILES \
|
-d $KEY_DIR $TARGET_FILES \
|
||||||
$DIST_OUT_DIR/signed-target_files.zip
|
$DIST_OUT_DIR/signed-target_files-$DEVICE.zip
|
||||||
|
|
||||||
python $BASEDIR/build/tools/releasetools/ota_from_target_files \
|
python $BASEDIR/build/tools/releasetools/ota_from_target_files \
|
||||||
-k $KEY_DIR/releasekey \
|
-k $KEY_DIR/releasekey \
|
||||||
$DIST_OUT_DIR/signed-target_files.zip \
|
-p $OUT_DIR/host/linux-x86 \
|
||||||
$DIST_OUT_DIR/$RELEASE.zip
|
$DIST_OUT_DIR/signed-target_files-$DEVICE.zip \
|
||||||
|
$DIST_OUT_DIR/$RELEASE-$DEVICE.zip
|
||||||
|
|
||||||
python $BASEDIR/build/tools/releasetools/img_from_target_files \
|
python $BASEDIR/build/tools/releasetools/img_from_target_files \
|
||||||
$DIST_OUT_DIR/signed-target_files.zip \
|
$DIST_OUT_DIR/signed-target_files-$DEVICE.zip \
|
||||||
$DIST_OUT_DIR/signed-img.zip
|
$DIST_OUT_DIR/signed-img-$DEVICE.zip
|
||||||
|
|
||||||
# get the recovery from the signed-img.zip
|
# get the recovery from the signed-img.zip
|
||||||
unzip -o -j $DIST_OUT_DIR/signed-img.zip recovery.img -d $DIST_OUT_DIR
|
unzip -o -j $DIST_OUT_DIR/signed-img-$DEVICE.zip recovery.img -d $DIST_OUT_DIR
|
||||||
|
mv $DIST_OUT_DIR/recovery.img $DIST_OUT_DIR/recovery-$DEVICE.img
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Finished successfully. Install zip and recovery:"
|
||||||
|
echo "$DIST_OUT_DIR/$RELEASE-$DEVICE.zip"
|
||||||
|
echo "$DIST_OUT_DIR/recovery-$DEVICE.img"
|
||||||
|
Loading…
Reference in New Issue
Block a user