diff options
Diffstat (limited to 'trunk/src/createpkg')
-rw-r--r-- | trunk/src/createpkg | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg index 87fa202..94469da 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -263,6 +263,10 @@ function load_parameters { CREATEPKG_AUTHOR="`eval_parameter CREATEPKG_AUTHOR`" TMP="`eval_parameter TMP /tmp`" + SIGN_PACKAGES="`eval_boolean_parameter SIGN_PACKAGES $off`" + SIGN_PACKAGES_USER="`eval_parameter SIGN_PACKAGES_USER`" + SIGN_PACKAGES_KEYID="`eval_parameter SIGN_PACKAGES_KEYID`" + REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE $off`" MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE $off`" MOVE_SLACK_REQUIRED="`eval_boolean_parameter MOVE_SLACK_REQUIRED $off`" @@ -385,8 +389,9 @@ function remove_old_package_data { cd $makepkg_repos # Using -mindepth 2 so it doesn't delete the new PACKAGE - for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta"`; do - candidate="`echo $file | sed -e 's/\.meta/\.tgz/'`" # otherwise PACKAGE info functions can fail + for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta" -o -name "$PACKAGE-*-*-*.tgz.asc"`; do + candidate="`echo $file | sed -e 's/\.meta$/\.tgz/'`" # otherwise PACKAGE info functions can fail + candidate="`echo $candidate | sed -e 's/\.asc$//'`" # otherwise PACKAGE info functions can fail # Just delete packages with different arch, version, build number or folder if [ "`package_version $candidate`" != "$PACKAGE_VERSION" ] || \ [ "`package_arch $candidate`" != "$PACKAGE_ARCH" ] || \ @@ -410,6 +415,7 @@ function remove_old_package_data { # Using -mindepth 2 so it doesn't delete the new package find $makepkg_repos -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -exec rm {} 2>/dev/null \; find $makepkg_repos -mindepth 2 -name "$PACKAGE-*-*-*.meta" -exec rm {} 2>/dev/null \; + find $makepkg_repos -mindepth 2 -name "$PACKAGE-*-*-*.tgz.asc" -exec rm {} 2>/dev/null \; find $makepkg_repos -name "$PACKAGE.slack-required" -exec rm {} 2>/dev/null \; fi fi @@ -671,6 +677,7 @@ PACKAGE_VERSION="`package_version $PKG_NAME`" PACKAGE_ARCH="`package_arch $PKG_NAME`" PACKAGE_BUILD="`package_build $PKG_NAME`" +# Update package author if [ ! -z "$CREATEPKG_AUTHOR" ]; then AUTHOR="`echo $PACKAGE_BUILD | sed -e 's/^[0-9]*//'`" if [ "$AUTHOR" != "$CREATEPKG_AUTHOR" ]; then @@ -685,6 +692,23 @@ if [ ! -z "$CREATEPKG_AUTHOR" ]; then fi fi +# Sign package +if [ $SIGN_PACKAGES -eq $on ]; then + + if [ ! -z "$SIGN_PACKAGES_KEYID" ]; then + SIGN_KEYID="-u $SIGN_PACKAGES_KEYID" + else + SIGN_KEYID="" + fi + + if [ ! -z "$SIGN_PACKAGES_USER" ]; then + su -c $SIGN_PACKAGES_USER -c "gpg --use-agent --armor -sb $SIGN_KEYID $PACKAGES_DIR/$PKG_NAME" + else + gpg --use-agent --armor -sb $SIGN_KEYID $PACKAGES_DIR/$PKG_NAME + fi + +fi + # Select repository directory if [ $MOVE_BIN_PACKAGE -eq $on ]; then SUBFOLDER="$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )" @@ -707,11 +731,16 @@ remove_old_package_data $PACKAGES_DIR if [ $MOVE_BIN_PACKAGE -eq $on ]; then mv $PACKAGES_DIR/$PKG_NAME $NEW_REPOS/ + if [ -e "$PACKAGES_DIR/$PKG_NAME.asc" ]; then + mv $PACKAGES_DIR/$PKG_NAME.asc $NEW_REPOS/ + fi + if [ -d "$NEW_REPOS/.svn" ]; then ( cd $NEW_REPOS chown_svn $PACKAGES_DIR && chgrp_svn $PACKAGES_DIR svn_add $PKG_NAME + svn_add $PKG_NAME.asc ) fi @@ -739,6 +768,7 @@ if [ $PACKAGES_REPOS_NOARCH -eq $on ] && [ "`package_arch $PKG_NAME`" == "noarch remove_old_package_data $NOARCH_DIR svn_copy $NEW_REPOS/$PKG_NAME $NOARCH_DIR/$SUBFOLDER/ svn_copy $NEW_REPOS/`basename $PKG_NAME .tgz`.meta $NOARCH_DIR/$SUBFOLDER/ + svn_copy $NEW_REPOS/`basename $PKG_NAME`.asc $NOARCH_DIR/$SUBFOLDER/ svn_copy $NEW_REPOS/$PACKAGE.slack-required $NOARCH_DIR/$SUBFOLDER/ update_metadata $NOARCH_DIR svn_remove_empty_folders $NOARCH_DIR |