diff options
-rw-r--r-- | trunk/doc/CHANGELOG | 2 | ||||
-rw-r--r-- | trunk/lib/common.sh | 42 | ||||
-rw-r--r-- | trunk/src/createpkg | 2 |
3 files changed, 39 insertions, 7 deletions
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG index f1d3843..1ae2a84 100644 --- a/trunk/doc/CHANGELOG +++ b/trunk/doc/CHANGELOG @@ -7,7 +7,7 @@ simplepkg changelog - new "compact" template storage format - common.sh: - default arch when its not present at /etc/slackware-version is now assumed to be "i486" - - other minor changes + - other minor changes and new functions - repository metainformationg is now added at svn control if applicable - new functions svn_remove_empty_folders, svn_del, su_svn, chown_svn, chgrp_svn, regexp_slash, default_distro and svn_add diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index c4224c8..a6f82bc 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -94,7 +94,7 @@ function install_packages { # check if the package was installed pack="`echo $pack | sed -e 's/\+/\\\+/'`" - installed=`eval "ls /$root/var/log/packages/ | grep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` + installed="`check_installed $pack $root`" check=$? if [ ! -z "$installed" ] && [ "$check" == "0" ]; then @@ -855,7 +855,7 @@ function update_jail_packages { # check if the package is installed pack="`echo $pack | sed -e 's/\+/\\\+/'`" - installed=`eval "ls /$1/var/log/packages/ | grep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` + installed="`check_installed $pack $1`" check=$? if [ -z "$installed" ] || [ "$check" != "0" ]; then @@ -1114,7 +1114,7 @@ function repo_gpg_key { # usage: repo_gpg_key <folder> - local folder="$1" + local folder="$1" tmp_gpg_folder if [ -z "$SIGN_KEYID" ]; then echo "GPG-KEY checking failed, no sign key id set." @@ -1125,11 +1125,34 @@ function repo_gpg_key { if [ -f "$folder/GPG-KEY" ]; then if ! gpg --with-colons < $folder/GPG-KEY | cut -d : -f 5 | grep -q -e "$SIGN_KEYID$"; then echo "Adding OpenPGP key id $SIGN_KEYID to $folder/GPG-KEY file..." + + tmp_gpg_folder="`mktemp -d $TMP/tmp_gpg_folder.XXXXXX`" + tmp_gpg_pubkey="`mktemp -d $TMP/tmp_gpg_pubkey.XXXXXX`" + if [ ! -z "$SIGN_PACKAGES_USER" ]; then - su $SIGN_PACKAGES_USER -c "gpg --export --armor $SIGN_KEYID" >> $folder/GPG-KEY + chown $SIGN_PACKAGES_USER $tmp_gpg_folder + chown $SIGN_PACKAGES_USER $tmp_gpg_pubkey + + # merge pubkey information in a temporary keyring + su $SIGN_PACKAGES_USER -c "gpg --export --armor $SIGN_KEYID > $tmp_gpg_pubkey/pubkey.asc" + su $SIGN_PACKAGES_USER -c "gpg --homedir $tmp_gpg_folder --import < $folder/GPG-KEY" + su $SIGN_PACKAGES_USER -c "gpg --homedir $tmp_gpg_folder --import < $tmp_gpg_pubkey/pubkey.asc" + + # export temporary keyring to repository keyring + su $SIGN_PACKAGES_USER -c "gpg --homedir $tmp_gpg_folder --export --armor" > $folder/GPG-KEY else - gpg --export --armor $SIGN_KEYID >> $folder/GPG-KEY + # merge pubkey information in a temporary keyring + gpg --export --armor $SIGN_KEYID > $tmp_gpg_pubkey/pubkey.asc + gpg --homedir $tmp_gpg_folder --import < $folder/GPG-KEY + gpg --homedir $tmp_gpg_folder --import < $tmp_gpg_pubkey/pubkey.asc + + # export temporary keyring to repository keyring + gpg --homedir $tmp_gpg_folder --export --armor > $folder/GPG-KEY fi + + # cleanup + rm -rf $tmp_gpg_folder $tmp_gpg_pubkey + fi else echo "Adding OpenPGP key id $SIGN_KEYID to $folder/GPG-KEY file..." @@ -1409,3 +1432,12 @@ function check_gnupg { fi } + +function check_installed { + + # checks if a package is installed + # usage: check_installed <package_name> [root] + + eval "ls /$2/var/log/packages/ | grep -E '^$1-[^-]+-[^-]+-[^-]+$'" + +} diff --git a/trunk/src/createpkg b/trunk/src/createpkg index 6c0a4df..2344a1b 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -141,7 +141,7 @@ function solve_dep { # Check package in local system PACK="`echo $PACK | sed -e 's/\+/\\\+/'`" - INSTALLED=`eval "ls /var/log/packages/ | grep -E '^$PACK-[^-]+-[^-]+-[^-]+$'"` + INSTALLED="`check_installed $PACK`" CHECK=$? # TODO: check dependency versions |