cure-fpm 1.3.3b → 1.6.0b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELIST +73 -0
- data/CONTRIBUTORS +1 -1
- data/LICENSE +1 -1
- data/lib/fpm.rb +2 -0
- data/lib/fpm/command.rb +100 -50
- data/lib/fpm/package.rb +42 -28
- data/lib/fpm/package/apk.rb +510 -0
- data/lib/fpm/package/cpan.rb +50 -25
- data/lib/fpm/package/deb.rb +211 -47
- data/lib/fpm/package/dir.rb +29 -28
- data/lib/fpm/package/empty.rb +6 -0
- data/lib/fpm/package/freebsd.rb +144 -0
- data/lib/fpm/package/gem.rb +5 -5
- data/lib/fpm/package/npm.rb +2 -2
- data/lib/fpm/package/osxpkg.rb +8 -7
- data/lib/fpm/package/p5p.rb +124 -0
- data/lib/fpm/package/pacman.rb +399 -0
- data/lib/fpm/package/pleaserun.rb +63 -0
- data/lib/fpm/package/pyfpm/get_metadata.py +9 -1
- data/lib/fpm/package/python.rb +19 -7
- data/lib/fpm/package/rpm.rb +58 -18
- data/lib/fpm/package/sh.rb +1 -7
- data/lib/fpm/package/solaris.rb +1 -1
- data/lib/fpm/package/tar.rb +14 -2
- data/lib/fpm/package/virtualenv.rb +145 -0
- data/lib/fpm/package/zip.rb +1 -1
- data/lib/fpm/rake_task.rb +60 -0
- data/lib/fpm/util.rb +176 -48
- data/lib/fpm/util/tar_writer.rb +80 -0
- data/lib/fpm/version.rb +1 -1
- data/templates/deb/postinst_upgrade.sh.erb +33 -2
- data/templates/deb/postrm_upgrade.sh.erb +10 -1
- data/templates/deb/preinst_upgrade.sh.erb +11 -2
- data/templates/deb/prerm_upgrade.sh.erb +14 -2
- data/templates/p5p_metadata.erb +12 -0
- data/templates/pacman.erb +47 -0
- data/templates/pacman/INSTALL.erb +41 -0
- data/templates/pleaserun/generate-cleanup.sh +17 -0
- data/templates/pleaserun/install-path.sh +17 -0
- data/templates/pleaserun/install.sh +117 -0
- data/templates/pleaserun/scripts/after-install.sh +4 -0
- data/templates/pleaserun/scripts/before-remove.sh +12 -0
- data/templates/rpm.erb +38 -6
- data/templates/sh.erb +38 -3
- metadata +81 -9
data/lib/fpm/version.rb
CHANGED
@@ -1,18 +1,50 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
after_upgrade() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:after_upgrade) -%>
|
3
8
|
<%= script(:after_upgrade) %>
|
4
9
|
<% end -%>
|
10
|
+
|
11
|
+
<% if attributes[:deb_systemd] -%>
|
12
|
+
systemctl --system daemon-reload >/dev/null || true
|
13
|
+
if ! systemctl is-enabled <%= attributes[:deb_systemd] %> >/dev/null
|
14
|
+
then
|
15
|
+
systemctl enable <%= attributes[:deb_systemd] %> >/dev/null || true
|
16
|
+
systemctl start <%= attributes[:deb_systemd] %> >/dev/null || true
|
17
|
+
<% if attributes[:deb_systemd_restart_after_upgrade?] -%>
|
18
|
+
else
|
19
|
+
systemctl restart <%= attributes[:deb_systemd] %> >/dev/null || true
|
20
|
+
<% end -%>
|
21
|
+
fi
|
22
|
+
<% end -%>
|
5
23
|
}
|
6
24
|
|
7
25
|
after_install() {
|
26
|
+
<%# Making sure that at least one command is in the function -%>
|
27
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
28
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
29
|
+
:
|
8
30
|
<% if script?(:after_install) -%>
|
9
31
|
<%= script(:after_install) %>
|
10
32
|
<% end -%>
|
33
|
+
|
34
|
+
<% if attributes[:deb_systemd] -%>
|
35
|
+
systemctl --system daemon-reload >/dev/null || true
|
36
|
+
systemctl enable <%= attributes[:deb_systemd] %> >/dev/null || true
|
37
|
+
systemctl start <%= attributes[:deb_systemd] %> >/dev/null || true
|
38
|
+
<% end -%>
|
11
39
|
}
|
12
40
|
|
13
|
-
if [ "${1}" = "configure" -a -z "${2}" ]
|
41
|
+
if [ "${1}" = "configure" -a -z "${2}" ] || \
|
42
|
+
[ "${1}" = "abort-remove" ]
|
14
43
|
then
|
15
44
|
# "after install" here
|
45
|
+
# "abort-remove" happens when the pre-removal script failed.
|
46
|
+
# In that case, this script, which should be idemptoent, is run
|
47
|
+
# to ensure a clean roll-back of the removal.
|
16
48
|
after_install
|
17
49
|
elif [ "${1}" = "configure" -a -n "${2}" ]
|
18
50
|
then
|
@@ -28,4 +60,3 @@ then
|
|
28
60
|
echo "Failed to install before the post-installation script was run." >&2
|
29
61
|
exit 1
|
30
62
|
fi
|
31
|
-
|
@@ -1,16 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
after_remove() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:after_remove) -%>
|
3
8
|
<%= script(:after_remove) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
dummy() {
|
13
|
+
:
|
8
14
|
}
|
9
15
|
|
10
16
|
|
11
|
-
if [ "${1}" = "remove" ]
|
17
|
+
if [ "${1}" = "remove" -o "${1}" = "abort-install" ]
|
12
18
|
then
|
13
19
|
# "after remove" goes here
|
20
|
+
# "abort-install" happens when the pre-installation script failed.
|
21
|
+
# In that case, this script, which should be idemptoent, is run
|
22
|
+
# to ensure a clean roll-back of the installation.
|
14
23
|
after_remove
|
15
24
|
elif [ "${1}" = "purge" -a -z "${2}" ]
|
16
25
|
then
|
@@ -1,10 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
before_upgrade() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:before_upgrade) -%>
|
3
8
|
<%= script(:before_upgrade) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
before_install() {
|
13
|
+
<%# Making sure that at least one command is in the function -%>
|
14
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
15
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
16
|
+
:
|
8
17
|
<% if script?(:before_install) -%>
|
9
18
|
<%= script(:before_install) %>
|
10
19
|
<% end -%>
|
@@ -16,7 +25,7 @@ then
|
|
16
25
|
elif [ "${1}" = "upgrade" -a -n "${2}" ]
|
17
26
|
then
|
18
27
|
upgradeFromVersion="${2}"
|
19
|
-
before_upgrade "${
|
28
|
+
before_upgrade "${upgradeFromVersion}"
|
20
29
|
elif [ "${1}" = "install" -a -n "${2}" ]
|
21
30
|
then
|
22
31
|
upgradeFromVersion="${2}"
|
@@ -24,7 +33,7 @@ then
|
|
24
33
|
# and a new version is installed.
|
25
34
|
# Looks a _lot_ like an upgrade case, I say we just execute the
|
26
35
|
# same "before upgrade" script as in the previous case
|
27
|
-
before_upgrade "${
|
36
|
+
before_upgrade "${upgradeFromVersion}"
|
28
37
|
elif echo "${1}" | grep -E -q '(fail|abort)'
|
29
38
|
then
|
30
39
|
echo "Failed to install before the pre-installation script was run." >&2
|
@@ -1,10 +1,23 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
before_remove() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:before_remove) -%>
|
3
8
|
<%= script(:before_remove) %>
|
4
9
|
<% end -%>
|
10
|
+
|
11
|
+
<%# Removing the systemd service-%>
|
12
|
+
<% if attributes[:deb_systemd] -%>
|
13
|
+
systemctl stop <%= attributes[:deb_systemd] %> >/dev/null || true
|
14
|
+
systemctl disable <%= attributes[:deb_systemd] %> >/dev/null || true
|
15
|
+
systemctl --system daemon-reload >/dev/null || true
|
16
|
+
<% end -%>
|
5
17
|
}
|
6
18
|
|
7
19
|
dummy() {
|
20
|
+
:
|
8
21
|
}
|
9
22
|
|
10
23
|
if [ "${1}" = "remove" -a -z "${2}" ]
|
@@ -13,13 +26,12 @@ then
|
|
13
26
|
before_remove
|
14
27
|
elif [ "${1}" = "upgrade" ]
|
15
28
|
then
|
16
|
-
upgradeVersionTo="${2}"
|
17
29
|
# Executed before the old version is removed
|
18
30
|
# upon upgrade.
|
19
31
|
# We should generally not do anything here. The newly installed package
|
20
32
|
# should do the upgrade, not the uninstalled one, since it can't anticipate
|
21
33
|
# what new things it will have to do to upgrade for the new version.
|
22
|
-
dummy
|
34
|
+
dummy
|
23
35
|
elif echo "${1}" | grep -E -q "(fail|abort)"
|
24
36
|
then
|
25
37
|
echo "Failed to install before the pre-removal script was run." >&2
|
@@ -0,0 +1,12 @@
|
|
1
|
+
set name=pkg.fmri value="<%=@name%>@<%=@version%>"
|
2
|
+
set name=pkg.summary value="<%=@description%>"
|
3
|
+
set name=pkg.human-version value="<%=@version%>"
|
4
|
+
set name=pkg.description value="<%=@description%>"
|
5
|
+
set name=info.classification value="org.opensolaris.category.2008:<%=@category%>"
|
6
|
+
set name=variant.opensolaris.zone <%= attributes[:p5p_zonetype] %>
|
7
|
+
set name=variant.arch value=<%=@architecture%>
|
8
|
+
<transform file dir -> set owner <%= attributes[:p5p_user] %>>
|
9
|
+
<transform file dir -> set group <%= attributes[:p5p_group] %>>
|
10
|
+
<transform dir path=opt$->drop>
|
11
|
+
<transform dir path=etc$->drop>
|
12
|
+
<transform dir path=usr(?:|/bin)$->drop>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Generated by fpm
|
2
|
+
# Hello packaging friend!
|
3
|
+
#
|
4
|
+
# If you find yourself using this 'fpm --edit' feature frequently, it is
|
5
|
+
# a sign that fpm is missing a feature! I welcome your feature requests!
|
6
|
+
# Please visit the following URL and ask for a feature that helps you never
|
7
|
+
# need to edit this file again! :)
|
8
|
+
# https://github.com/jordansissel/fpm/issues
|
9
|
+
# ------------------------------------------------------------------------
|
10
|
+
#
|
11
|
+
pkgname = <%= name %>
|
12
|
+
<% if !epoch.nil? -%>
|
13
|
+
pkgver = <%= epoch %>:<%= version %>-<%= iteration %>
|
14
|
+
<% else -%>
|
15
|
+
pkgver = <%= version %>-<%= iteration %>
|
16
|
+
<% end -%>
|
17
|
+
pkgdesc = <%= description %>
|
18
|
+
<% if !url.nil? and !url.empty? -%>
|
19
|
+
url = <%= url %>
|
20
|
+
<% else -%>
|
21
|
+
url = http://nourlgiven.example.com/
|
22
|
+
<% end -%>
|
23
|
+
builddate = <%= builddate %>
|
24
|
+
packager = <%= maintainer %>
|
25
|
+
size = <%= size %>
|
26
|
+
arch = <%= architecture %>
|
27
|
+
license = <%= license %>
|
28
|
+
<% replaces.each do |repl| -%>
|
29
|
+
replaces = <%= repl %>
|
30
|
+
<% end -%>
|
31
|
+
group = <%= category %>
|
32
|
+
<% conflicts.each do |confl| -%>
|
33
|
+
conflict = <%= confl %>
|
34
|
+
<% end -%>
|
35
|
+
<% provides.each do |prov| -%>
|
36
|
+
provides = <%= prov %>
|
37
|
+
<% end -%>
|
38
|
+
<% config_files.each do |conf| -%>
|
39
|
+
<% conf.gsub(/^\/+/, "") -%>
|
40
|
+
backup = <%= conf %>
|
41
|
+
<% end -%>
|
42
|
+
<% dependencies.each do |req| -%>
|
43
|
+
depend = <%= req %>
|
44
|
+
<% end -%>
|
45
|
+
<% attributes.fetch(:pacman_opt_depends, []).each do |opt| -%>
|
46
|
+
optdepend = <%= opt %>
|
47
|
+
<% end -%>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%# In each function, a `:` is the first command. -%>
|
2
|
+
<%# This makes sure that at least one command is in the function -%>
|
3
|
+
<%# This avoids a lot of potential errors, including the case that -%>
|
4
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
5
|
+
<%# see issue #875 for more details -%>
|
6
|
+
<% if script?(:before_install) -%>
|
7
|
+
pre_install() {
|
8
|
+
:
|
9
|
+
<%= script(:before_install) %>
|
10
|
+
}
|
11
|
+
<% end -%>
|
12
|
+
<% if script?(:after_install) -%>
|
13
|
+
post_install() {
|
14
|
+
:
|
15
|
+
<%= script(:after_install) %>
|
16
|
+
}
|
17
|
+
<% end -%>
|
18
|
+
<% if script?(:before_upgrade) -%>
|
19
|
+
pre_upgrade() {
|
20
|
+
:
|
21
|
+
<%= script(:before_upgrade) %>
|
22
|
+
}
|
23
|
+
<% end -%>
|
24
|
+
<% if script?(:after_upgrade) -%>
|
25
|
+
post_upgrade() {
|
26
|
+
:
|
27
|
+
<%= script(:after_upgrade) %>
|
28
|
+
}
|
29
|
+
<% end -%>
|
30
|
+
<% if script?(:before_remove) -%>
|
31
|
+
pre_remove() {
|
32
|
+
:
|
33
|
+
<%= script(:before_remove) %>
|
34
|
+
}
|
35
|
+
<% end -%>
|
36
|
+
<% if script?(:after_remove) -%>
|
37
|
+
post_remove() {
|
38
|
+
:
|
39
|
+
<%= script(:after_remove) %>
|
40
|
+
}
|
41
|
+
<% end -%>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
show_cleanup_step() {
|
4
|
+
d="${1##.}"
|
5
|
+
if [ ! -z "$d" ] ; then
|
6
|
+
if [ -d "$1" -a ! -d "$d" ] ; then
|
7
|
+
echo "rmdir \"$d\""
|
8
|
+
fi
|
9
|
+
if [ -f "$1" ] ; then
|
10
|
+
echo "rm \"$d\""
|
11
|
+
fi
|
12
|
+
fi
|
13
|
+
}
|
14
|
+
|
15
|
+
for i in "$@" ; do
|
16
|
+
show_cleanup_step "$i"
|
17
|
+
done
|
@@ -0,0 +1,117 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
source="<%= attributes[:prefix] %>"
|
4
|
+
|
5
|
+
cleanup_script="$source/cleanup.sh"
|
6
|
+
|
7
|
+
silent() {
|
8
|
+
"$@" > /dev/null 2>&1
|
9
|
+
}
|
10
|
+
|
11
|
+
install_files() {
|
12
|
+
# TODO(sissel): Need to know what prefix the files exist at
|
13
|
+
platform="$1"
|
14
|
+
version="$(version_${platform})"
|
15
|
+
|
16
|
+
(
|
17
|
+
# TODO(sissel): Should I just rely on rsync for this stuff?
|
18
|
+
cd "${source}/${platform}/${version}/files/" || exit 1
|
19
|
+
|
20
|
+
# Write a cleanup script
|
21
|
+
find . -print0 | xargs -r0 -n1 "$source/generate-cleanup.sh" > "$cleanup_script"
|
22
|
+
|
23
|
+
# Actually do the installation
|
24
|
+
find . -print0 | xargs -r0 -n1 "$source/install-path.sh"
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
install_actions() {
|
29
|
+
# TODO(sissel): Need to know what prefix the files exist at
|
30
|
+
platform="$1"
|
31
|
+
version="$(version_${platform})"
|
32
|
+
|
33
|
+
|
34
|
+
actions="${source}/${platform}/${version}/install_actions.sh"
|
35
|
+
if [ -f "$actions" ] ; then
|
36
|
+
. "$actions"
|
37
|
+
fi
|
38
|
+
}
|
39
|
+
|
40
|
+
version_systemd() {
|
41
|
+
# Treat all systemd versions the same
|
42
|
+
echo default
|
43
|
+
}
|
44
|
+
|
45
|
+
version_launchd() {
|
46
|
+
# Treat all launchd versions the same
|
47
|
+
echo 10.9
|
48
|
+
}
|
49
|
+
|
50
|
+
version_upstart() {
|
51
|
+
# Treat all upstart versions the same
|
52
|
+
# TODO(sissel): Upstart 0.6.5 needs to be handled specially.
|
53
|
+
version="$(initctl --version | head -1 | tr -d '()' | awk '{print $NF}')"
|
54
|
+
|
55
|
+
case $version in
|
56
|
+
0.6.5) echo $version ;;
|
57
|
+
*) echo "1.5" ;; # default modern assumption
|
58
|
+
esac
|
59
|
+
}
|
60
|
+
|
61
|
+
version_sysv() {
|
62
|
+
# TODO(sissel): Once pleaserun supports multiple sysv implementations, maybe
|
63
|
+
# we inspect the OS to find out what we should target.
|
64
|
+
echo lsb-3.1
|
65
|
+
}
|
66
|
+
|
67
|
+
has_systemd() {
|
68
|
+
# Some OS vendors put systemd in ... different places ...
|
69
|
+
[ -d "/lib/systemd/system/" -o -d "/usr/lib/systemd/system" ] && silent which systemctl
|
70
|
+
}
|
71
|
+
|
72
|
+
has_upstart() {
|
73
|
+
[ -d "/etc/init" ] && silent which initctl
|
74
|
+
}
|
75
|
+
|
76
|
+
has_sysv() {
|
77
|
+
[ -d "/etc/init.d" ]
|
78
|
+
}
|
79
|
+
|
80
|
+
#has_freebsd_rcng() {
|
81
|
+
#[ -d "/etc/rc.d" ] && silent which rcorder
|
82
|
+
#}
|
83
|
+
|
84
|
+
has_daemontools() {
|
85
|
+
[ -d "/service" ] && silent which sv
|
86
|
+
}
|
87
|
+
|
88
|
+
has_launchd() {
|
89
|
+
[ -d "/Library/LaunchDaemons" ] && silent which launchtl
|
90
|
+
}
|
91
|
+
|
92
|
+
install_help() {
|
93
|
+
case $platform in
|
94
|
+
systemd) echo "To start this service, use: systemctl start <%= attributes[:pleaserun_name] %>" ;;
|
95
|
+
upstart) echo "To start this service, use: initctl start <%= attributes[:pleaserun_name] %>" ;;
|
96
|
+
launchd) echo "To start this service, use: launchctl start <%= attributes[:pleaserun_name] %>" ;;
|
97
|
+
sysv) echo "To start this service, use: /etc/init.d/<%= attributes[:pleaserun_name] %> start" ;;
|
98
|
+
esac
|
99
|
+
}
|
100
|
+
|
101
|
+
platforms="systemd upstart launchd sysv"
|
102
|
+
installed=0
|
103
|
+
for platform in $platforms ; do
|
104
|
+
if has_$platform ; then
|
105
|
+
version="$(version_$platform)"
|
106
|
+
echo "Platform $platform ($version) detected. Installing service."
|
107
|
+
install_files $platform
|
108
|
+
install_actions $platform
|
109
|
+
install_help $platform
|
110
|
+
installed=1
|
111
|
+
break
|
112
|
+
fi
|
113
|
+
done
|
114
|
+
|
115
|
+
if [ "$installed" -eq 0 ] ; then
|
116
|
+
echo "Failed to detect any service platform, so no service was installed. Files are available in ${source} if you need them."
|
117
|
+
fi
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
source="<%= attributes[:prefix] %>"
|
4
|
+
|
5
|
+
if [ -f "$source/cleanup.sh" ] ; then
|
6
|
+
echo "Running cleanup to remove service for package <%= attributes[:name] %>"
|
7
|
+
set -e
|
8
|
+
sh "$source/cleanup.sh"
|
9
|
+
|
10
|
+
# Remove the script also since the package installation generated it.
|
11
|
+
rm "$source/cleanup.sh"
|
12
|
+
fi
|
data/templates/rpm.erb
CHANGED
@@ -17,8 +17,11 @@
|
|
17
17
|
# Disable checking for unpackaged files ?
|
18
18
|
#%undefine __check_files
|
19
19
|
|
20
|
-
# Use <%= attributes[:rpm_digest] %> file digest method
|
20
|
+
# Use <%= attributes[:rpm_digest] %> file digest method.
|
21
|
+
# The first macro is the one used in RPM v4.9.1.1
|
21
22
|
%define _binary_filedigest_algorithm <%= digest_algorithm %>
|
23
|
+
# This is the macro I find on OSX when Homebrew provides rpmbuild (rpm v5.4.14)
|
24
|
+
%define _build_binary_file_digest_algo <%= digest_algorithm %>
|
22
25
|
|
23
26
|
# Use <%= attributes[:rpm_compression] %> payload compression
|
24
27
|
%define _binary_payload <%= payload_compression %>
|
@@ -38,9 +41,9 @@ Version: <%= version %>
|
|
38
41
|
<% if epoch -%>
|
39
42
|
Epoch: <%= epoch %>
|
40
43
|
<% end -%>
|
41
|
-
Release: <%= iteration or 1 %>
|
44
|
+
Release: <%= iteration or 1 %><%= "%{?dist}" if attributes[:rpm_dist] %>
|
42
45
|
<%# use the first line of the description as the summary -%>
|
43
|
-
Summary: <%=
|
46
|
+
Summary: <%= summary %>
|
44
47
|
<% if !attributes[:rpm_autoreqprov?] -%>
|
45
48
|
AutoReqProv: no
|
46
49
|
<% else -%>
|
@@ -80,6 +83,9 @@ Packager: <%= maintainer %>
|
|
80
83
|
<% dependencies.each do |req| -%>
|
81
84
|
Requires: <%= req %>
|
82
85
|
<% end -%>
|
86
|
+
<% (attributes[:rpm_tags] or []).each do |tag| -%>
|
87
|
+
<%= tag %>
|
88
|
+
<% end -%>
|
83
89
|
<% end -%>
|
84
90
|
<% provides.each do |prov| -%>
|
85
91
|
Provides: <%= prov %>
|
@@ -120,42 +126,60 @@ Obsoletes: <%= repl %>
|
|
120
126
|
<% if script?(:before_upgrade) or script?(:before_install) -%>
|
121
127
|
%pre
|
122
128
|
upgrade() {
|
129
|
+
<%# Making sure that at least one command is in the function -%>
|
130
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
131
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
132
|
+
:
|
123
133
|
<% if script?(:before_upgrade) -%>
|
124
134
|
<%= script(:before_upgrade) %>
|
125
135
|
<% end -%>
|
126
136
|
}
|
127
137
|
install() {
|
138
|
+
<%# Making sure that at least one command is in the function -%>
|
139
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
140
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
141
|
+
:
|
128
142
|
<% if script?(:before_install) -%>
|
129
143
|
<%= script(:before_install) %>
|
130
144
|
<% end -%>
|
131
145
|
}
|
132
146
|
if [ "${1}" -eq 1 ]
|
133
147
|
then
|
134
|
-
install
|
135
148
|
# "before install" goes here
|
149
|
+
install
|
136
150
|
elif [ "${1}" -gt 1 ]
|
137
151
|
then
|
152
|
+
# "before upgrade" goes here
|
138
153
|
upgrade
|
139
154
|
fi
|
140
155
|
<% end -%>
|
141
156
|
<% if script?(:after_upgrade) or script?(:after_install) -%>
|
142
|
-
%
|
157
|
+
%post
|
143
158
|
upgrade() {
|
159
|
+
<%# Making sure that at least one command is in the function -%>
|
160
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
161
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
162
|
+
:
|
144
163
|
<% if script?(:after_upgrade) -%>
|
145
164
|
<%= script(:after_upgrade) %>
|
146
165
|
<% end -%>
|
147
166
|
}
|
148
167
|
install() {
|
168
|
+
<%# Making sure that at least one command is in the function -%>
|
169
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
170
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
171
|
+
:
|
149
172
|
<% if script?(:after_install) -%>
|
150
173
|
<%= script(:after_install) %>
|
151
174
|
<% end -%>
|
152
175
|
}
|
153
176
|
if [ "${1}" -eq 1 ]
|
154
177
|
then
|
178
|
+
# "after install" goes here
|
155
179
|
install
|
156
|
-
# "before install" goes here
|
157
180
|
elif [ "${1}" -gt 1 ]
|
158
181
|
then
|
182
|
+
# "after upgrade" goes here
|
159
183
|
upgrade
|
160
184
|
fi
|
161
185
|
<% end -%>
|
@@ -163,6 +187,10 @@ fi
|
|
163
187
|
%preun
|
164
188
|
if [ "${1}" -eq 0 ]
|
165
189
|
then
|
190
|
+
<%# Making sure that at least one command is in the function -%>
|
191
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
192
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
193
|
+
:
|
166
194
|
<%= script(:before_remove) %>
|
167
195
|
fi
|
168
196
|
<% end -%>
|
@@ -170,6 +198,10 @@ fi
|
|
170
198
|
%postun
|
171
199
|
if [ "${1}" -eq 0 ]
|
172
200
|
then
|
201
|
+
<%# Making sure that at least one command is in the function -%>
|
202
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
203
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
204
|
+
:
|
173
205
|
<%= script(:after_remove) %>
|
174
206
|
fi
|
175
207
|
<% end -%>
|