Initial commit

This commit is contained in:
Alex D. 2021-07-18 21:50:08 +00:00
commit aff29ea948
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
10 changed files with 217 additions and 0 deletions

51
base/alpine-base/APKBUILD Normal file
View File

@ -0,0 +1,51 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alpine-base
pkgver=3.14.0
pkgrel=0
pkgdesc="Meta package for minimal alpine base"
url="https://alpinelinux.org"
arch="noarch"
license="MIT"
options="!check"
depends="
alpine-baselayout
apk-tools
alpine-keys
busybox
busybox-initscripts
openrc
musl
"
package() {
mkdir -p "$pkgdir"/etc
# create /etc/alpine-release
echo $pkgver > "$pkgdir"/etc/alpine-release
local _ver="$(echo "$pkgver" | grep -E -o '^[0-9]+\.[0-9]+')"
local _rel="v$_ver"
case "$pkgver" in
*_alpha*|*_beta*|*_pre*)
_ver="$pkgver (edge)"
_rel="edge"
;;
esac
# create /etc/issue
cat >"$pkgdir"/etc/issue<<EOF
Welcome to Alpine Linux $_ver
Kernel \\r on an \\m (\\l)
EOF
# create os-release
cat >"$pkgdir"/etc/os-release<<EOF
NAME="Alpine Linux"
ID=alpine
VERSION_ID=$pkgver
PRETTY_NAME="Alpine Linux $_rel"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
EOF
}

View File

@ -0,0 +1,104 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alpine-baselayout
pkgver=3.2.0
pkgrel=18
pkgdesc="Alpine base dir structure and init scripts"
url="https://git.alpinelinux.org/cgit/aports/tree/main/alpine-baselayout"
arch="all"
license="GPL-2.0-only"
options="!check"
install="
$pkgname.pre-install
$pkgname.pre-upgrade
$pkgname.post-upgrade
$pkgname.post-install
"
_nbver=6.3
source="
group
inittab
passwd
profile
protocols-$_nbver::https://salsa.debian.org/md/netbase/-/raw/v$_nbver/etc/protocols
services-$_nbver::https://salsa.debian.org/md/netbase/-/raw/v$_nbver/etc/services
"
builddir="$srcdir/build"
prepare() {
default_prepare
mkdir -p "$builddir"
mv "$srcdir"/protocols-$_nbver "$srcdir"/protocols
mv "$srcdir"/services-$_nbver "$srcdir"/services
}
build() {
# generate shadow
awk -F: '{
pw = ":!:"
if ($1 == "root") { pw = "::" }
print($1 pw ":0:::::")
}' "$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
cat > etc/motd <<-EOF
Welcome to Alpine!
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
EOF
install -m644 \
"$srcdir"/group \
"$srcdir"/passwd \
"$srcdir"/inittab \
"$srcdir"/profile \
"$srcdir"/protocols \
"$srcdir"/services \
etc/
install -m640 "$builddir"/shadow \
etc/
# symlinks
ln -s /proc/mounts etc/mtab
}
sha512sums="
356ec457ad1f1866e268a04d32e4952bca19977ff3017e912c62a30c4681ea1281390b06b2d009d17665c1ffae591506580a084ef9ef1ec273a00b6d60dbf15a group
fdab6f8fec2a556ab817d90a73635a927ea04dbc4e0470ed59ee6a62c87393f9534c9b746b09a776d938c25b8af9c9fb1686578e24f8307d1d074921ade1bdc7 inittab
f6fe247889a9c09a1c6ac6b1f5baae9ecc9f6300594428dc04dd8e7543c06b4774f57cf034e970a913faf7bbf0aff28b170e5c6425ab04b380b34a3b80a3b529 passwd
2e0c19c08bc161278db950ca66c138091724a134ccbaa655cb7efa933f32ce28cfc006a563d0c150646c8ac7b6c84ab03f0958fd1a55c17e7d3f91c9ff0c1e94 profile
eadc83e47fcc354ab83fd109bee452bda170886fb684e67faf615930c11480919505f4af60c685b124efc54af0ded9522663132f911eac6622144f8b4c8be695 protocols-6.3
47b0f3ee73af2d259bd206a026204be0ea25531a895a0b035a904b38fe5407bc3dd2beab7f8fcb3d760587e6159702ebdb9cbc4f508942befdf7f10c10c87888 services-6.3
"

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 @@
alpine-baselayout.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 @@
alpine-baselayout.pre-install

View File

@ -0,0 +1,3 @@
root:x:0:root
nogroup:x:65533:
nobody:x:65534:

View File

@ -0,0 +1,23 @@
# /etc/inittab
::sysinit:/sbin/openrc sysinit
::sysinit:/sbin/openrc boot
::wait:/sbin/openrc default
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/sbin/openrc shutdown

View File

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

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