Add lfsbase and nnd files

This commit is contained in:
Alex D. 2022-01-11 20:10:41 +00:00
parent 0e0e590a90
commit 275981e796
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
9 changed files with 166 additions and 0 deletions

87
main/lfsbase/APKBUILD Normal file
View File

@ -0,0 +1,87 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=lfsbase
pkgver=1.0
pkgrel=0
pkgdesc="Base directory structure for linux"
url="none"
arch="noarch"
license="GPL-2.0-only"
options="!check"
install="
$pkgname.pre-install
$pkgname.post-install
$pkgname.pre-upgrade
$pkgname.post-upgrade
"
source="
group
passwd
profile
"
builddir="$srcdir/build"
prepare() {
default_prepare
mkdir -p "$builddir"
}
_passwd2shadow() {
local name="$(echo "$1" | cut -d: -f1)"
printf '%s:!:::::::\n' "$name"
}
build() {
while read -r LINE; do
_passwd2shadow "$LINE"
done < "$srcdir"/passwd > shadow
}
package() {
mkdir -p "$pkgdir"
cd "$pkgdir"
install -m 0755 -d \
etc \
var \
mnt \
proc \
run \
sys
install -d -m 0700 root
install -d -m 1777 tmp
ln -s /run var/run
ln -s /tmp var/tmp
echo "localhost" > etc/hostname
cat > etc/hosts <<-EOF
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
EOF
cat > etc/shells <<-EOF
# valid login shells
/bin/sh
/bin/ash
EOF
install -m644 \
"$srcdir"/group \
"$srcdir"/passwd \
"$srcdir"/profile \
etc/
install -m640 "$builddir"/shadow \
etc/
# symlinks
ln -s /proc/mounts etc/mtab
}
sha512sums="
e322a393aee9633981cb8669af30429899fed859e9709d4b888d17af43feb65474fe822e7aa8f06e7127ee7b6cf2d66d2f56698fd4314e0f8ab737ce275d1914 group
f6fe247889a9c09a1c6ac6b1f5baae9ecc9f6300594428dc04dd8e7543c06b4774f57cf034e970a913faf7bbf0aff28b170e5c6425ab04b380b34a3b80a3b529 passwd
2e0c19c08bc161278db950ca66c138091724a134ccbaa655cb7efa933f32ce28cfc006a563d0c150646c8ac7b6c84ab03f0958fd1a55c17e7d3f91c9ff0c1e94 profile
"

4
main/lfsbase/group Normal file
View File

@ -0,0 +1,4 @@
root:x:0:root
shadow:x:42:
nogroup:x:65533:
nobody:x:65534:

View File

@ -0,0 +1,4 @@
#!/bin/sh
# force /etc/shadow to be owned by root and not be world readable
chown root:shadow /etc/shadow

View File

@ -0,0 +1 @@
lfsbase.post-install

View File

@ -0,0 +1,5 @@
#!/bin/sh
addgroup -S -g 42 shadow 2>/dev/null
exit 0

View File

@ -0,0 +1 @@
lfsbase.pre-install

2
main/lfsbase/passwd Normal file
View File

@ -0,0 +1,2 @@
root:x:0:0:root:/root:/bin/ash
nobody:x:65534:65534:nobody:/:/sbin/nologin

23
main/lfsbase/profile Normal file
View File

@ -0,0 +1,23 @@
# Append "$1" to $PATH when not already in.
# Copied from Arch Linux, see #12803 for details.
append_path () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
;;
esac
}
append_path "/usr/local/sbin"
append_path "/usr/local/bin"
append_path "/usr/sbin"
append_path "/usr/bin"
append_path "/sbin"
append_path "/bin"
unset -f append_path
export PATH
export PAGER=less
umask 022

39
main/nnd/APKBUILD Normal file
View File

@ -0,0 +1,39 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=nnd
pkgver=0.1
pkgrel=0
pkgdesc="Identification package for nnd"
url="none"
arch="noarch"
license="MIT"
builddir="$srcdir/"
build() {
local NAME="nonamedistribution"
echo "$pkgver" > release
cat >issue <<-EOF
Welcome to $NAME $pkgver
Kernel \\r on \\m (\\l)
EOF
cat >os-release <<-EOF
NAME="$NAME"
ID=nnd
VERSION_ID=$pkgver
PRETTY_NAME="$NAME $pkgver"
EOF
cat >motd <<-EOF
Welcome to $NAME $pkgver, a extension/distribution based on Alpine!
EOF
}
package() {
install -Dm444 "$builddir"/os-release "$pkgdir"/etc/os-release
install -Dm444 "$builddir"/issue "$pkgdir"/etc/issue
install -Dm444 "$builddir"/motd "$pkgdir"/etc/motd
}