|
1 | 1 | #!/bin/sh |
2 | 2 | # Copyright 2023 One Identity LLC. ALL RIGHTS RESERVED |
3 | | -pp_revision="20230127" |
| 3 | +pp_revision="20231108" |
4 | 4 | # Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED. |
5 | 5 | # |
6 | 6 | # Redistribution and use in source and binary forms, with or without |
@@ -794,6 +794,11 @@ pp_strip_binaries () { |
794 | 794 | fi |
795 | 795 | } |
796 | 796 |
|
| 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 | + |
797 | 802 | pp_if_true=0 |
798 | 803 | pp_if_false=0 |
799 | 804 |
|
@@ -1293,6 +1298,7 @@ pp_files_expand () { |
1293 | 1298 | if test $# -gt 0; then |
1294 | 1299 | _a=`eval echo \"$1\"` |
1295 | 1300 | case ",$_a," in *,volatile,*) _flags="${_flags}v";; esac |
| 1301 | + case ",$_a," in *,missingok,*) _flags="${_flags}m";; esac |
1296 | 1302 | case ",$_a," in *,optional,*) _optional=true;; esac |
1297 | 1303 | case ",$_a," in *,symlink,*) _has_target=true;; esac |
1298 | 1304 | case ",$_a," in *,ignore-others,*) _flags="${_flags}i";; esac |
@@ -1948,6 +1954,10 @@ pp_backend_aix () { |
1948 | 1954 | cat $root_wrkdir/$pp_aix_bff_name.$ex.inventory |
1949 | 1955 | fi >&2 |
1950 | 1956 |
|
| 1957 | + for fileset in ${pp_aix_deprecated_filesets}; do |
| 1958 | + echo "$fileset" |
| 1959 | + done >$user_wrkdir/$pp_aix_bff_name.$ex.namelist |
| 1960 | + |
1951 | 1961 | if test x"" != x"${pp_aix_copyright:-$copyright}"; then |
1952 | 1962 | echo "${pp_aix_copyright:-$copyright}" > $user_wrkdir/$pp_aix_bff_name.$ex.copyright |
1953 | 1963 | echo "${pp_aix_copyright:-$copyright}" > $root_wrkdir/$pp_aix_bff_name.$ex.copyright |
@@ -5702,7 +5712,10 @@ pp_rpm_writefiles () { |
5702 | 5712 | test x"$farch" = x"noarch" || pp_add_to_list pp_rpm_arch_seen $farch |
5703 | 5713 | fi |
5704 | 5714 |
|
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 |
5706 | 5719 | echo "$_l" |
5707 | 5720 | done |
5708 | 5721 | echo |
@@ -6321,7 +6334,7 @@ pp_rpm_service_group_make_init_script () { |
6321 | 6334 | local script=/etc/init.d/$grp |
6322 | 6335 | local out=$pp_destdir$script |
6323 | 6336 |
|
6324 | | - pp_add_file_if_missing $script run 755 || return 0 |
| 6337 | + pp_add_file_if_missing $script run 755 m || return 0 |
6325 | 6338 |
|
6326 | 6339 | cat <<-. >>$out |
6327 | 6340 | #!/bin/sh |
@@ -6411,7 +6424,7 @@ pp_rpm_service_make_service_files () { |
6411 | 6424 | local out=$pp_destdir$script |
6412 | 6425 | local _process _cmd _rpmlevels |
6413 | 6426 |
|
6414 | | - pp_add_file_if_missing $script run 755 || return 0 |
| 6427 | + pp_add_file_if_missing $script run 755 m || return 0 |
6415 | 6428 |
|
6416 | 6429 | #-- start out as an empty shell script |
6417 | 6430 | cat <<-'.' >$out |
@@ -7954,8 +7967,8 @@ pp_backend_bsd_init () { |
7954 | 7967 | pp_bsd_desc= |
7955 | 7968 | pp_bsd_message= |
7956 | 7969 |
|
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 |
7959 | 7972 | pp_bsd_pkg_sfx=pkg |
7960 | 7973 | else |
7961 | 7974 | pp_bsd_pkg_sfx=txz |
@@ -8982,17 +8995,29 @@ pp_systemd_service_install_common () { |
8982 | 8995 | ;; |
8983 | 8996 | esac |
8984 | 8997 | 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 |
8987 | 9007 | fi |
8988 | 9008 |
|
8989 | 9009 | # Enable the $svc.service |
8990 | 9010 | $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 | +
|
8991 | 9016 | $systemctl_cmd enable $svc.service >/dev/null 2>&1 |
8992 | 9017 |
|
8993 | 9018 | # Now that the service has been enabled, start it again if it was running before. |
8994 | 9019 | 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 |
8996 | 9021 | fi |
8997 | 9022 | fi |
8998 | 9023 | } |
@@ -9058,6 +9083,8 @@ pp_systemd_service_remove_common () { |
9058 | 9083 | _pp_systemd_init |
9059 | 9084 | fi |
9060 | 9085 |
|
| 9086 | + $systemctl_cmd stop $svc.service > /dev/null 2>&1 |
| 9087 | +
|
9061 | 9088 | # Remove the systemd unit service file |
9062 | 9089 | if [ "x$systemd_service_dir" != "x$systemd_system_unit_dir" ]; then |
9063 | 9090 | rm -f "$systemd_system_unit_dir/$svc.service" |
|
0 commit comments