Skip to content

Commit 0f40753

Browse files
committed
Update PolyPkg from upstream.
1 parent a6ac589 commit 0f40753

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

scripts/pp

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# Copyright 2023 One Identity LLC. ALL RIGHTS RESERVED
3-
pp_revision="20230127"
3+
pp_revision="20231108"
44
# Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED.
55
#
66
# Redistribution and use in source and binary forms, with or without
@@ -794,6 +794,11 @@ pp_strip_binaries () {
794794
fi
795795
}
796796

797+
pp_is_version_greater () {
798+
smaller_version="$(echo -e "$1\n$2" | sort -V | head -1)"
799+
test x"$smaller_version" = x"$1"
800+
}
801+
797802
pp_if_true=0
798803
pp_if_false=0
799804

@@ -1293,6 +1298,7 @@ pp_files_expand () {
12931298
if test $# -gt 0; then
12941299
_a=`eval echo \"$1\"`
12951300
case ",$_a," in *,volatile,*) _flags="${_flags}v";; esac
1301+
case ",$_a," in *,missingok,*) _flags="${_flags}m";; esac
12961302
case ",$_a," in *,optional,*) _optional=true;; esac
12971303
case ",$_a," in *,symlink,*) _has_target=true;; esac
12981304
case ",$_a," in *,ignore-others,*) _flags="${_flags}i";; esac
@@ -1948,6 +1954,10 @@ pp_backend_aix () {
19481954
cat $root_wrkdir/$pp_aix_bff_name.$ex.inventory
19491955
fi >&2
19501956

1957+
for fileset in ${pp_aix_deprecated_filesets}; do
1958+
echo "$fileset"
1959+
done >$user_wrkdir/$pp_aix_bff_name.$ex.namelist
1960+
19511961
if test x"" != x"${pp_aix_copyright:-$copyright}"; then
19521962
echo "${pp_aix_copyright:-$copyright}" > $user_wrkdir/$pp_aix_bff_name.$ex.copyright
19531963
echo "${pp_aix_copyright:-$copyright}" > $root_wrkdir/$pp_aix_bff_name.$ex.copyright
@@ -5702,7 +5712,10 @@ pp_rpm_writefiles () {
57025712
test x"$farch" = x"noarch" || pp_add_to_list pp_rpm_arch_seen $farch
57035713
fi
57045714

5705-
case $f in *v*) _l="%config(noreplace) $_l";; esac
5715+
case $f in
5716+
*v*) _l="%config(noreplace) $_l";;
5717+
*m*) _l="%config(missingok) $_l";;
5718+
esac
57065719
echo "$_l"
57075720
done
57085721
echo
@@ -6321,7 +6334,7 @@ pp_rpm_service_group_make_init_script () {
63216334
local script=/etc/init.d/$grp
63226335
local out=$pp_destdir$script
63236336

6324-
pp_add_file_if_missing $script run 755 || return 0
6337+
pp_add_file_if_missing $script run 755 m || return 0
63256338

63266339
cat <<-. >>$out
63276340
#!/bin/sh
@@ -6411,7 +6424,7 @@ pp_rpm_service_make_service_files () {
64116424
local out=$pp_destdir$script
64126425
local _process _cmd _rpmlevels
64136426

6414-
pp_add_file_if_missing $script run 755 || return 0
6427+
pp_add_file_if_missing $script run 755 m || return 0
64156428

64166429
#-- start out as an empty shell script
64176430
cat <<-'.' >$out
@@ -7954,8 +7967,8 @@ pp_backend_bsd_init () {
79547967
pp_bsd_desc=
79557968
pp_bsd_message=
79567969

7957-
# FreeBSD uses package.txz, DragonFly uses package.pkg.
7958-
if [ "$pp_bsd_os" = "DragonFly" ]; then
7970+
# Newer "pkg" (>=1.17.0) generates package.pkg, before that package.txz.
7971+
if pp_is_version_greater 1.17.0 "$(pkg --version)"; then
79597972
pp_bsd_pkg_sfx=pkg
79607973
else
79617974
pp_bsd_pkg_sfx=txz
@@ -8982,17 +8995,29 @@ pp_systemd_service_install_common () {
89828995
;;
89838996
esac
89848997
fi
8985-
else
8986-
RUNNING=1
8998+
fi
8999+
9000+
# If the service is not running according to its sysv script (eg. systemd service
9001+
# is not using a pidfile the sysv script needs), or its sysv script is not present any more,
9002+
# check how systemd thinks.
9003+
# We also try to restart the service in case something went wrong with it.
9004+
if $systemctl_cmd is-active "$svc" >/dev/null 2>&1 || $systemctl_cmd is-failed "$svc" >/dev/null 2>&1; then
9005+
$systemctl_cmd stop "$svc" >/dev/null 2>&1
9006+
RUNNING=0
89879007
fi
89889008
89899009
# Enable the $svc.service
89909010
$systemctl_cmd daemon-reload >/dev/null 2>&1
9011+
9012+
# We do not need the init.d script any more, and it causes problems on SLES
9013+
# where systemd sysv compatibility is enforced and broken on default installs
9014+
rm -f "/etc/init.d/$svc"
9015+
89919016
$systemctl_cmd enable $svc.service >/dev/null 2>&1
89929017
89939018
# Now that the service has been enabled, start it again if it was running before.
89949019
if [ $RUNNING -eq 0 ]; then
8995-
/etc/init.d/$svc start > /dev/null 2>&1
9020+
$systemctl_cmd start $svc.service >/dev/null 2>&1
89969021
fi
89979022
fi
89989023
}
@@ -9058,6 +9083,8 @@ pp_systemd_service_remove_common () {
90589083
_pp_systemd_init
90599084
fi
90609085
9086+
$systemctl_cmd stop $svc.service > /dev/null 2>&1
9087+
90619088
# Remove the systemd unit service file
90629089
if [ "x$systemd_service_dir" != "x$systemd_system_unit_dir" ]; then
90639090
rm -f "$systemd_system_unit_dir/$svc.service"

0 commit comments

Comments
 (0)