diff options
Diffstat (limited to 'system/adelie-base')
-rw-r--r-- | system/adelie-base/APKBUILD | 24 | ||||
-rwxr-xr-x | system/adelie-base/addgroup | 36 | ||||
-rwxr-xr-x | system/adelie-base/adduser | 90 |
3 files changed, 146 insertions, 4 deletions
diff --git a/system/adelie-base/APKBUILD b/system/adelie-base/APKBUILD index c2ecee897..766b77863 100644 --- a/system/adelie-base/APKBUILD +++ b/system/adelie-base/APKBUILD @@ -3,19 +3,28 @@ pkgname=adelie-base pkgver=0.3.3 -pkgrel=0 +pkgrel=1 pkgdesc="The Adélie Linux Base System" url="http://adelielinux.org/" arch="noarch" license="NCSA" -depends="apk-tools shadow sysklogd libarchive-tools zsh binutils at coreutils diffutils fcron file findutils shimmy grep procps util-linux mailx man-db patch sed sharutils bc vim psmisc net-tools kbd less" +depends="apk-tools shadow + libarchive-tools file shimmy grep procps + zsh bash + binutils coreutils diffutils findutils sharutils + util-linux net-tools kbd + sysklogd at fcron + mailx man-db patch sed bc vim psmisc less" makedepends="" install="" options="!check !fhs" subpackages="$pkgname-doc $pkgname-posix $pkgname-lsb dev-kit:devkit" source="https://distfiles.adelielinux.org/source/$pkgname/$pkgname-$pkgver.tar.xz group - passwd" + passwd + addgroup + adduser + " build() { # taken from Alpine Base Layout @@ -35,6 +44,11 @@ package() { make install DESTDIR="$pkgdir" install -m644 "$srcdir"/group "$pkgdir"/etc/group install -m644 "$srcdir"/passwd "$pkgdir"/etc/passwd + + # stupid inflatable stupid busybox + for i in adduser addgroup; do + install -m755 "$srcdir"/$i "$pkgdir"/usr/sbin/$i + done } doc() { @@ -68,4 +82,6 @@ devkit() { sha512sums="ffa0f9d5d91ab3a5cef021b6f4ab010fa936055146e33002b8741b8302f638439453a2db7544d3d37a8eba9d3d9a3f85856e6cc25950639a4d7a1927072d09c6 adelie-base-0.3.3.tar.xz e6775b9e1c6421338aaceee375b3b74aa100fd444e369b280ce45c9167119b76bebc11737d7f929e50e20a553a35e0e25f7d0f71deb0483d3bccc08e319dcf98 group -9eede0c1cd56a9ffb5227cc9446cdb1bbe73d5f17cd5ee99cf29acca3160f3a96d79e1420311a140f9d9f32950b9823b33ad84dadf7b85921d4f1a945dd5a252 passwd" +9eede0c1cd56a9ffb5227cc9446cdb1bbe73d5f17cd5ee99cf29acca3160f3a96d79e1420311a140f9d9f32950b9823b33ad84dadf7b85921d4f1a945dd5a252 passwd +a5035c18efc50be5d0c8dd452619d781da09c9441ed53462c99693170d1ae2b4306a81846e42b616c5ef8cd5b6fbbf047f93ae5ee9613126581cf701b3a6ade7 addgroup +9e53246d7674279b64962eb45060f07a752f86e9b3cee49b4b05be4dd13113b03c18e62381c92546fae9b05b3dc6100f29cea48c716b3219d973444f71e1fd5a adduser" diff --git a/system/adelie-base/addgroup b/system/adelie-base/addgroup new file mode 100755 index 000000000..051df3696 --- /dev/null +++ b/system/adelie-base/addgroup @@ -0,0 +1,36 @@ +#!/bin/sh +# addgroup - BusyBox compatibility shim +# bbshim +# +# Copyright © 2017 A. Wilcox. All rights reserved. +# Licensed under the terms of the NCSA Open Source license. +# + +ARG= +CMDLINE= + +while getopts :g:S ARG +do + case $ARG in + g) CMDLINE="$CMDLINE -g \"$OPTARG\"" ;; + S) CMDLINE="$CMDLINE -r" ;; + :) exit 1 ;; + \?) exit 1 ;; + esac +done + +shift $(($OPTIND - 1)) + +if [ -z "$*" ]; then + echo "$0: group name is required" >&2 + exit 1 +fi + +set "$@" + + +if [ -n "$2" ]; then + exec usermod -a -G $2 $1 +fi + +groupadd $CMDLINE $1 diff --git a/system/adelie-base/adduser b/system/adelie-base/adduser new file mode 100755 index 000000000..ba9d90a61 --- /dev/null +++ b/system/adelie-base/adduser @@ -0,0 +1,90 @@ +#!/bin/sh +# adduser - BusyBox compatibility shim +# bbshim +# +# Copyright © 2017 A. Wilcox. All rights reserved. +# Licensed under the terms of the NCSA Open Source license. +# + +# The GECOS for the new user. +GECOS="Linux User,,," + +# Additional groups in which to add the new user. +MYGROUPS= + +# Path to the home directory for the new user. +HOMEDIR= + +# Don't call passwd(1) for the new user afterwards. +NOPASSWD=0 + +# The new user's shell. +MYSHELL=$SHELL + +# An alternative skeleton directory for the new user's home directory. +SKEL=/etc/skel + +# The new user is a system user. +SYSTEM=0 + +# Use this UID number for the new user. +MYUID= + + +ARG= + +while getopts h:g:s:G:SDHu:k: ARG +do + case $ARG in + h) HOMEDIR=$OPTARG ;; + g) GECOS=$OPTARG ;; + s) MYSHELL=$OPTARG ;; + G) MYGROUPS=$OPTARG ;; + S) SYSTEM=1 + MYSHELL="/bin/false";; + D) NOPASSWD=1 ;; + H) unset HOMEDIR ;; + u) MYUID=$OPTARG ;; + k) SKEL=$OPTARG ;; + :) exit 1 ;; + \?) exit 1 ;; + esac +done + +shift $(($OPTIND - 1)) + +if [ -z "$*" ]; then + echo "$0: user name is required" >&2 + exit 1 +fi + +set "$@" + + +CMDLINE="-s $MYSHELL" + +if [ -n "$MYGROUPS" ]; then + CMDLINE="$CMDLINE -g $MYGROUPS" +fi + +if [ -n "$HOMEDIR" ]; then + CMDLINE="$CMDLINE -m -d \"$HOMEDIR\" -k \"$SKEL\"" +fi + +if [ $SYSTEM -ne 0 ]; then + CMDLINE="$CMDLINE -r" +fi + +if [ -n "$MYUID" ]; then + CMDLINE="$CMDLINE -u $MYUID" +fi + +if [ -n "$2" ]; then + CMDLINE="$CMDLINE -g $2" +fi + +useradd -c "$GECOS" $CMDLINE $1 + +#if [ $NOPASSWD -eq 0 ]; then +# passwd $1 +#fi |