-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugins_deb_rules.sh
More file actions
executable file
·58 lines (46 loc) · 1.64 KB
/
plugins_deb_rules.sh
File metadata and controls
executable file
·58 lines (46 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash -e
#
# simple script to build module/theme tarballs and generate maintainer scripts
# intended to be run from the install target of the debian/rules file
if [[ "$DH_VERBOSE" -ne 0 ]]; then
set -x
fi
PROGNAME="${progname:-$(awk '/^Source/ {print $2}' debian/control)}"
BUILDROOT="${buildroot:-"debian/$PROGNAME"}"
TMP="${tmp:-debian/tmp}"
TIMESTAMP="2025-01-01 00:00:00Z"
for plugin in modules/* themes/*; do
plugin_name=$(basename "$plugin")
plugin_dir="$(dirname "${plugin/s}")-archives"
plugin_tar_file="$plugin_name.wb${plugin:0:1}.gz"
plugin_path="$BUILDROOT-$plugin_name/usr/share/$PROGNAME/$plugin_dir"
mkdir -p "$plugin_path"
plugin_tar_path="$plugin_path/$plugin_tar_file"
tar --sort=name --mtime="$TIMESTAMP" --format=posix \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime,delete=mtime \
-C "$(dirname "$plugin")" -cf "$plugin_tar_path" "$plugin_name"
maint_script="debian/$PROGNAME-$plugin_name"
cat > "$maint_script.postinst" <<EOF
#!/bin/sh
set -e
export PERL5LIB=/usr/share/$PROGNAME
cd /usr/share/$PROGNAME
./install-module.pl $plugin_dir/$plugin_tar_file
#DEBHELPER#
EOF
if [[ -e "debian/postinst.d/$plugin_name" ]]; then
cat "debian/postinst.d/$plugin_name" >> "$maint_script.postinst"
fi
cat > "$maint_script.postrm" <<EOF
#!/bin/sh
set -e
rm -rf /usr/share/$PROGNAME/$plugin_name
#DEBHELPER#
EOF
for post_script in "$maint_script.postinst" "$maint_script.postrm"; do
sed -i "s|^-e #!/bin/sh|#!/bin/sh|" "$post_script"
touch -d "$TIMESTAMP" "$post_script"
done
done
exit 0