# characters only and no spaces.
CREATEPKG_AUTHOR=""
+# Whether createpkg should sign packages.
+SIGN_PACKAGES="off"
+
+# Username used for package signatures.
+SIGN_PACKAGES_USER=""
+
+# GPG key id used for package signature, leave blank to use default key.
+SIGN_PACKAGES_KEYID=""
+
#---------------------------------------------------------------------
# SIMPLARET SECTION
#---------------------------------------------------------------------
# Whether to check package signatures (you should have the repository
# maintainer key on your keyring)
-SIGNATURE_CHECKING="0"
+SIGNATURE_CHECKING="on"
# Whether simplaret will try to solve dependencies by looking
# for packages' slack-required
- renamed all "MAKEPKG" config parameters to "PACKAGES", "MAKEPKG_REPOS" to "PACKAGES_DIR"
- new config parameters PACKAGES_REPOS_STYLE, MOVE_SLACK_REQUIRED, MKBUILDS_SVN_USER,
PACKAGES_SVN_USER, PACKAGES_SVN_GROUP, MKBUILDS_SVN_GROUP, PACKAGES_REPOS_NOARCH,
- PACKAGES_SVN, CREATEPKG_AUTHOR
+ PACKAGES_SVN, CREATEPKG_AUTHOR, SIGN_PACKAGES, SIGN_PACKAGES_USER. SIGN_PACKAGES_KEYID
- cleaner -s option output
- lspkg: fix on package search routine
- jail-commit: using unified diff
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`"
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" ] || \
# 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
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
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/} )"
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
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
# echo $folder/$candidate
silent="--silent"
fi
- if [ -f "$folder/$candidate.asc" ] || [ "$SIGNATURE_CHECKING" == "1" ]; then
+ if [ -f "$folder/$candidate.asc" ] || [ "$SIGNATURE_CHECKING" == "$on" ]; then
gpg --verify $folder/$candidate.asc $folder/$candidate
+ if [ "$?" != "0" ]; then
+ echo "Package signature does not match. Removing package."
+ rm -f $folder/$candidate.asc $folder/$candidate
+ LAST_DOWNLOADED_PACKAGE=""
+ return 1
+ fi
fi
# generate the patches FILE_LIST and PACKAGES.TXT if needed
if [ "$generate_patches" == "1" ]; then
- gen_patches_filelst $folder
+ gen_patches_filelist $folder
gen_packages_txt $folder
gen_md5_checksums $folder
fi