diff options
-rw-r--r-- | PKGBUILD | 36 | ||||
-rw-r--r-- | arch-policy.patch | 55 |
2 files changed, 82 insertions, 9 deletions
@@ -10,15 +10,33 @@ _pkgname=adduser-debian pkgver=3.131 pkgrel=1 pkgdesc="Debian's 'adduser' and 'deluser' commands for creating and removing users" -arch=('any') +arch=("any") url="https://salsa.debian.org/debian/adduser" -license=('GPL2') +license=("GPL2") # TODO: Aren't `shadow` and `perl` also dependencies? -depends=('gawk') -# TODO: Manage configuration files -# TODO: ...changelog? Do other Arch packages actually use this? -source=("https://salsa.debian.org/debian/adduser/-/archive/debian/${pkgver}/${_pkgname}-${pkgver}.tar.gz") -sha256sums=('3ce6de32bce048d12429d9431b36d8437c1934266475b6a9f5235b3dff54f918') +depends=("gawk") +backup=("etc/adduser.conf" "etc/deluser.conf") +source=("https://salsa.debian.org/debian/adduser/-/archive/debian/${pkgver}/${_pkgname}-${pkgver}.tar.gz" + "arch-policy.patch") +sha256sums=("3ce6de32bce048d12429d9431b36d8437c1934266475b6a9f5235b3dff54f918" + "82600db78ad765623226839061e23f34e1f199bc63c16e731dce0f00829d33f1") + +# Arch's UID/GID policy differs a little from Debian's. I've included a patch +# which issues the necessary changes to both the template configuration files +# as well as the scripts themselves. These changes include the following: +# * Automatically chosen system user/group IDs start at 500 instead of 100 +# * Automatically chosen regular user/group IDs end at 60000 instead of 59999 +# Sources: useradd(8) and /etc/login.defs +# TODO: Patch the manpages as well +# TODO: Improve user name regex. According to useradd(8) Arch allows uppercase +# characters, underscores and numbers in the first character (but not dashes) +# and additionally has an overall character limit of 32 characters. None of +# this is currently checked. +# TODO: That covers all of the policy differences I've noticed, but there may +# be more that I didn't notice. +prepare() { + patch -Np0 -d . -i arch-policy.patch +} # TODO: Run tests, but only in isolation from main system # TODO: Should include `copyright` file from repository for attribution info @@ -27,12 +45,12 @@ sha256sums=('3ce6de32bce048d12429d9431b36d8437c1934266475b6a9f5235b3dff54f918') # TODO: Locale/translation files should also be included package() { cd ${_pkgname}-${pkgver} + install -Dm755 adduser "${pkgdir}/usr/bin/adduser" install -Dm755 deluser "${pkgdir}/usr/bin/deluser" ln -s adduser "${pkgdir}/usr/bin/addgroup" ln -s deluser "${pkgdir}/usr/bin/delgroup" - # TODO: Do the policies defined in these files match Arch policy? Do I need - # to develop any patches for them? + install -Dm755 adduser.conf "${pkgdir}/etc/adduser.conf" install -Dm755 deluser.conf "${pkgdir}/etc/deluser.conf" install -Dm755 AdduserCommon.pm "${pkgdir}/usr/share/perl5/vendor_perl/Debian/AdduserCommon.pm" diff --git a/arch-policy.patch b/arch-policy.patch new file mode 100644 index 000000000000..9f85489242d6 --- /dev/null +++ b/arch-policy.patch @@ -0,0 +1,55 @@ +diff '--color=auto' -rupN adduser-debian-3.131.orig/AdduserCommon.pm adduser-debian-3.131/AdduserCommon.pm +--- adduser-debian-3.131.orig/AdduserCommon.pm 2023-02-19 16:44:55.239704864 +1030 ++++ adduser-debian-3.131/AdduserCommon.pm 2023-02-19 21:37:36.388307790 +1030 +@@ -286,14 +286,14 @@ sub preseed_config { + backup => 0, + backup_to => ".", + dshell => "/bin/bash", +- first_system_uid => 100, ++ first_system_uid => 500, + last_system_uid => 999, + first_uid => 1000, +- last_uid => 59999, +- first_system_gid => 100, ++ last_uid => 60000, ++ first_system_gid => 500, + last_system_gid => 999, + first_gid => 1000, +- last_gid => 59999, ++ last_gid => 60000, + dhome => "/home", + skel => "/etc/skel", + usergroups => "yes", +diff '--color=auto' -rupN adduser-debian-3.131.orig/adduser.conf adduser-debian-3.131/adduser.conf +--- adduser-debian-3.131.orig/adduser.conf 2023-02-19 16:44:55.239704864 +1030 ++++ adduser-debian-3.131/adduser.conf 2023-02-19 21:37:33.024856943 +1030 +@@ -21,21 +21,21 @@ + # Specify inclusive ranges of UIDs and GIDs from which UIDs and GIDs + # for system users, system groups, non-system users and non-system groups + # can be dynamically allocated. +-# Default: FIRST_SYSTEM_UID=100, LAST_SYSTEM_UID=999 +-#FIRST_SYSTEM_UID=100 ++# Default: FIRST_SYSTEM_UID=500, LAST_SYSTEM_UID=999 ++#FIRST_SYSTEM_UID=500 + #LAST_SYSTEM_UID=999 + +-# Default: FIRST_SYSTEM_GID=100, LAST_SYSTEM_GID=999 +-#FIRST_SYSTEM_GID=100 ++# Default: FIRST_SYSTEM_GID=500, LAST_SYSTEM_GID=999 ++#FIRST_SYSTEM_GID=500 + #LAST_SYSTEM_GID=999 + +-# Default: FIRST_UID=1000, LAST_UID=59999 ++# Default: FIRST_UID=1000, LAST_UID=60000 + #FIRST_UID=1000 +-#LAST_UID=59999 ++#LAST_UID=60000 + +-# Default: FIRST_GID=1000, LAST_GID=59999 ++# Default: FIRST_GID=1000, LAST_GID=60000 + #FIRST_GID=1000 +-#LAST_GID=59999 ++#LAST_GID=60000 + + # Specify a file or a directory containing UID and GID pool. + #UID_POOL=/etc/adduser-pool.conf |