diff options
Diffstat (limited to 'scripts/dpkg-maintscript-helper.sh')
-rwxr-xr-x | scripts/dpkg-maintscript-helper.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh index 2e5d207bc..a113a938e 100755 --- a/scripts/dpkg-maintscript-helper.sh +++ b/scripts/dpkg-maintscript-helper.sh @@ -46,6 +46,8 @@ rm_conffile() { [ -n "$1" ] || error "maintainer script parameters are missing" [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" + [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ + error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ "${CONFFILE}" != "${CONFFILE#/}" ] || \ error "conffile '$CONFFILE' is not an absolute path" validate_optional_version "$LASTVERSION" @@ -94,7 +96,7 @@ prepare_rm_conffile() { local md5sum old_md5sum md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')" old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \ - sed -n -e "\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" + sed -n -e "\\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" if [ "$md5sum" != "$old_md5sum" ]; then mv -f "$CONFFILE" "$CONFFILE.dpkg-backup" else @@ -156,6 +158,8 @@ mv_conffile() { [ -n "$1" ] || error "maintainer script parameters are missing" [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" + [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ + error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ "${OLDCONFFILE}" != "${OLDCONFFILE#/}" ] || \ error "old-conffile '$OLDCONFFILE' is not an absolute path" [ "${NEWCONFFILE}" != "${NEWCONFFILE#/}" ] || \ @@ -203,7 +207,7 @@ prepare_mv_conffile() { local md5sum old_md5sum md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')" old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$PACKAGE" | \ - sed -n -e "\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" + sed -n -e "\\'^ $CONFFILE ' { s/ obsolete$//; s/.* //; p }")" if [ "$md5sum" = "$old_md5sum" ]; then mv -f "$CONFFILE" "$CONFFILE.dpkg-remove" fi @@ -262,6 +266,8 @@ symlink_to_dir() { [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" + [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ + error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ -n "$PACKAGE" ] || error "cannot identify the package" [ -n "$SYMLINK" ] || error "symlink parameter is missing" [ "${SYMLINK#/}" = "$SYMLINK" ] && \ @@ -340,6 +346,8 @@ dir_to_symlink() { [ -n "$DPKG_MAINTSCRIPT_NAME" ] || \ error "environment variable DPKG_MAINTSCRIPT_NAME is required" + [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ] || \ + error "environment variable DPKG_MAINTSCRIPT_PACKAGE is required" [ -n "$PACKAGE" ] || error "cannot identify the package" [ -n "$PATHNAME" ] || error "directory parameter is missing" [ "${PATHNAME#/}" = "$PATHNAME" ] && \ @@ -416,7 +424,7 @@ prepare_dir_to_symlink() # we should not perform the switch. export DPKG_MAINTSCRIPT_HELPER_INTERNAL_API="$version" find "$PATHNAME" -print0 | \ - xargs -0 -n1 $0 _internal_pkg_must_own_file "$PACKAGE" || \ + xargs -0 -n1 "$0" _internal_pkg_must_own_file "$PACKAGE" || \ error "directory '$PATHNAME' contains files not owned by" \ "package $PACKAGE, cannot switch to symlink" unset DPKG_MAINTSCRIPT_HELPER_INTERNAL_API @@ -457,7 +465,7 @@ finish_dir_to_symlink() ABS_SYMLINK_TARGET="$SYMLINK_TARGET" fi rm "$PATHNAME/.dpkg-staging-dir" - find "$PATHNAME" -mindepth 1 -print0 | \ + find "$PATHNAME" -mindepth 1 -maxdepth 1 -print0 | \ xargs -0 -i% mv -f "%" "$ABS_SYMLINK_TARGET/" # Remove the staging directory. @@ -560,7 +568,7 @@ COLOR_BOLD_WHITE='[1;37m' setup_colors() { - : ${DPKG_COLORS=auto} + : "${DPKG_COLORS=auto}" case "$DPKG_COLORS" in auto) |