summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in29
1 files changed, 24 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 1d9d8f13..b4366a56 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -148,6 +148,15 @@ clean_up() {
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package_${pkg}.log"*
done
fi
+
+ # clean up dangling symlinks to packages
+ for pkg in ${pkgname[@]}; do
+ for file in ${pkg}-*-*-${CARCH}${PKGEXT}; do
+ if [[ -h $file && ! -e $file ]]; then
+ rm -f $file
+ fi
+ done
+ done
fi
fi
@@ -1002,21 +1011,22 @@ create_package() {
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
- local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
local ret=0
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
- bsdtar -cf - $comp_files * > "$pkg_file" || ret=$?
+ bsdtar -cf - $comp_files * > "$tar_file" || ret=$?
shopt -u nullglob
if (( ! ret )); then
case "$PKGEXT" in
- *tar.gz) gzip -f -n "$pkg_file" ;;
- *tar.bz2) bzip2 -f "$pkg_file" ;;
- *tar.xz) xz -z -f "$pkg_file" ;;
+ *tar.gz) gzip -f -n "$tar_file" ;;
+ *tar.bz2) bzip2 -f "$tar_file" ;;
+ *tar.xz) xz -z -f "$tar_file" ;;
esac
ret=$?
fi
@@ -1025,6 +1035,15 @@ create_package() {
error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code
fi
+
+ if (( ! ret )) && [[ "$PKGDEST" != "${startdir}" ]]; then
+ ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
+ ret=$?
+ fi
+
+ if (( ret )); then
+ warning "$(gettext "Failed to create symlink to package file.")"
+ fi
}
create_srcpackage() {