summaryrefslogtreecommitdiff
path: root/debian/postinst.in
diff options
context:
space:
mode:
authorLibravatar Santiago Vila <sanvila@debian.org>2023-09-29 22:04:00 +0200
committerLibravatar Mubashshir <ahm@jadupc.com>2023-12-03 16:19:49 +0600
commit8bf29443882648e8fa3d641e2ca22162b9efdd73 (patch)
tree2386fa87ababe5f21557b7509ac765d14eb45111 /debian/postinst.in
parentaaaa6dfeaa45166e74202a50e48080d83a3e03b8 (diff)
downloadbase-files-debian/12.4+deb12u2.tar.gz
base-files-debian/12.4+deb12u2.zip
Import Debian version 12.4+deb12u2debian/12.4+deb12u2
base-files (12.4+deb12u2) bookworm; urgency=medium . * Change /etc/debian_version to 12.2, for Debian 12.2 point release. . base-files (12.4+deb12u1) bookworm; urgency=medium . * Change /etc/debian_version to 12.1, for Debian 12.1 point release. . base-files (12.4) unstable; urgency=medium . * Release candidate for bookworm as stable: - Use "12" as version in /etc/issue and /etc/issue.net. (never expected to change after release) - Use 12.0 as version in /etc/debian_version. (expected to change at every point release) - Change PRETTY_NAME in /usr/lib/os-release, adding 12 as version number and "(bookworm)" as codename. Add also VERSION_ID and VERSION. (never expected to change) - Variable VERSION_CODENAME was already defined as "bookworm". - Update README (bookworm -> trixie). * Refresh GFDL-1.2, GFDL-1.3, GPL-3, LGPL-2 and LGPL-3 from their canonical place at https://ftp.gnu.org/gnu/Licenses/ as they have minor editorial changes like trimming spaces, https, etc. * Drop debian/current-md5sums-obsolete. Closes: #1009358. * Ship a real debian/copyright file in source package instead of generating it at build time. * Call dh_installchangelogs using --no-trim option. Add versioned build-dependency on debhelper for the above. * Update lintian-overrides to new format. * Rules-Requires-Root: binary-targets. * Update standards version to 4.6.2. . base-files (12.3) unstable; urgency=high . * Add VERSION_CODENAME to /etc/os-release. Closes: #1008735. This still respects the fact that Debian distributions do not have a version number until they are actually released as stable, but makes /etc/os-release a little bit more useful for those who use testing as a pre-release for the next stable. Those users are also the reason why in this case we are simply using the string "bookworm". . base-files (12.2) unstable; urgency=medium . * A simplified version of the patch for DPKG_ROOT was applied, but the simplification went too far and was incorrect. Closes: #824594. * Use $() instead of `` when calling md5sum. . base-files (12.1) unstable; urgency=medium . * Add support for DPKG_ROOT to postinst. Closes: #824594 . base-files (12) unstable; urgency=medium . * Do not create /var/run/utmp in postinst, as /var/run is ephemeral and it does not make sense. Closes: #989725. * Do not create /var/lib/dpkg/status if missing anymore, as dpkg already does that. Closes: #989726. * Change issue, issue.net, debian_version and os-release to read "bookworm/sid". Closes: #992369. * Drop VERSION, VERSION_ID and CODENAME from os-release.
Diffstat (limited to 'debian/postinst.in')
-rw-r--r--debian/postinst.in90
1 files changed, 38 insertions, 52 deletions
diff --git a/debian/postinst.in b/debian/postinst.in
index 499f41a..0ad4ce3 100644
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -1,52 +1,60 @@
#!/bin/sh
set -e
+ensure_file_owner_mode() {
+ if [ ! -f "$DPKG_ROOT$1" ]; then
+ : > "$DPKG_ROOT$1"
+ fi
+ chown "$2" "$DPKG_ROOT$1"
+ chmod "$3" "$DPKG_ROOT$1"
+}
+
install_local_dir() {
- if [ ! -d $1 ]; then
- mkdir -p $1
+ if [ ! -d "$DPKG_ROOT$1" ]; then
+ mkdir -p "$DPKG_ROOT$1"
fi
- if [ -f /etc/staff-group-for-usr-local ]; then
- chown root:staff $1 2> /dev/null || true
- chmod 2775 $1 2> /dev/null || true
+ if [ -f "$DPKG_ROOT/etc/staff-group-for-usr-local" ]; then
+ chown root:staff "$DPKG_ROOT$1" 2>/dev/null || true
+ chmod 2775 "$DPKG_ROOT$1" 2> /dev/null || true
fi
}
install_from_default() {
- if [ ! -f $2 ]; then
- cp -p /usr/share/base-files/$1 $2
+ if [ ! -f "$DPKG_ROOT$2" ]; then
+ cp -p "$DPKG_ROOT/usr/share/base-files/$1" "$DPKG_ROOT$2"
fi
}
install_directory() {
- if [ ! -d /$1 ]; then
- mkdir /$1
- chown root:$3 /$1
- chmod $2 /$1
+ if [ ! -d "$DPKG_ROOT/$1" ]; then
+ mkdir "$DPKG_ROOT/$1"
+ chown "root:$3" "$DPKG_ROOT/$1"
+ chmod "$2" "$DPKG_ROOT/$1"
fi
}
migrate_directory() {
- if [ ! -L $1 ]; then
- rmdir $1
- ln -s $2 $1
+ if [ ! -L "$DPKG_ROOT$1" ]; then
+ rmdir "$DPKG_ROOT$1"
+ ln -s "$2" "$DPKG_ROOT$1"
fi
}
update_to_current_default() {
- if [ -f $2 ]; then
- md5=`md5sum $2 | cut -f 1 -d " "`
- if grep -q "$md5" /usr/share/base-files/$1.md5sums; then
- if ! cmp -s /usr/share/base-files/$1 $2; then
- cp -p /usr/share/base-files/$1 $2
+ if [ -f "$2" ]; then
+ md5=$(md5sum "$2" | cut -f 1 -d " ")
+ if grep -q "$md5" "/usr/share/base-files/$1.md5sums"; then
+ if ! cmp -s "/usr/share/base-files/$1" "$2"; then
+ cp -p "/usr/share/base-files/$1" "$2"
echo Updating $2 to current default.
fi
fi
fi
}
-if [ ! -e /etc/dpkg/origins/default ]; then
- if [ -e /etc/dpkg/origins/#VENDORFILE# ]; then
- ln -sf #VENDORFILE# /etc/dpkg/origins/default
+if [ ! -e "$DPKG_ROOT/etc/dpkg/origins/default" ]; then
+ if [ -e "$DPKG_ROOT/etc/dpkg/origins/#VENDORFILE#" ]; then
+ ln -sf #VENDORFILE# "$DPKG_ROOT/etc/dpkg/origins/default"
fi
fi
@@ -62,8 +70,8 @@ if [ "$1" = "configure" ] && [ "$2" = "" ]; then
install_directory var/opt 755 root
install_directory media 755 root
install_directory var/mail 2775 mail
- if [ ! -L /var/spool/mail ]; then
- ln -s ../mail /var/spool/mail
+ if [ ! -L "$DPKG_ROOT/var/spool/mail" ]; then
+ ln -s ../mail "$DPKG_ROOT/var/spool/mail"
fi
install_directory run/lock 1777 root
migrate_directory /var/run /run
@@ -79,38 +87,16 @@ if [ "$1" = "configure" ] && [ "$2" = "" ]; then
install_local_dir /usr/local/sbin
install_local_dir /usr/local/src
install_local_dir /usr/local/etc
- ln -sf share/man /usr/local/man
-
- if [ ! -f /var/log/wtmp ]; then
- echo -n>/var/log/wtmp
- fi
- if [ ! -f /var/log/btmp ]; then
- echo -n>/var/log/btmp
- fi
- if [ ! -f /var/log/lastlog ]; then
- echo -n>/var/log/lastlog
- fi
- chown root:utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
- chmod 664 /var/log/wtmp /var/log/lastlog
- chmod 660 /var/log/btmp
- if [ ! -f /var/run/utmp ]; then
- echo -n>/var/run/utmp
- fi
- chown root:utmp /var/run/utmp
- chmod 664 /var/run/utmp
-fi
+ ln -sf share/man "$DPKG_ROOT/usr/local/man"
-if [ ! -d /var/lib/dpkg ]; then
- mkdir -m 755 -p /var/lib/dpkg
-fi
-if [ ! -f /var/lib/dpkg/status ]; then
- echo > /var/lib/dpkg/status
- chmod 644 /var/lib/dpkg/status
+ ensure_file_owner_mode /var/log/wtmp root:utmp 664
+ ensure_file_owner_mode /var/log/btmp root:utmp 660
+ ensure_file_owner_mode /var/log/lastlog root:utmp 664
fi
-if [ -d /usr/share/info ] && [ ! -f /usr/info/dir ] && [ ! -f /usr/share/info/dir ]; then
+if [ -d "$DPKG_ROOT/usr/share/info" ] && [ ! -f "$DPKG_ROOT/usr/info/dir" ] && [ ! -f "$DPKG_ROOT/usr/share/info/dir" ]; then
install_from_default info.dir /usr/share/info/dir
- chmod 644 /usr/share/info/dir
+ chmod 644 $DPKG_ROOT/usr/share/info/dir
fi
if [ "$1" = "configure" ] && [ "$2" != "" ]; then