Updated every file, added a few more.

- zsh is used instead of bash.
	- passwd, shadow and group are added, as users are required as
	  some point.
	- mdev.conf added to populate /dev.
	- sysctl.conf added… it’s empty, but at least there’s a
	  skeleton.
master
Luka Vandervelden 2019-08-19 19:55:50 +02:00
parent 64869c410f
commit 50357fe1f9
12 changed files with 210 additions and 51 deletions

27
group Normal file
View File

@ -0,0 +1,27 @@
root::0:root
bin::1:root,bin,daemon
daemon::2:root,bin,daemon
sys::3:root,bin
adm::4:root,daemon
tty::5:
disk::6:root
lp::7:daemon
mem::8:
kmem::9:
wheel::10:root
ftp::11:
mail::12:
mlocate::13:
dialout::14:
www::15:
audio::16:
video::17:
floppy::18:
tape::19:
scanner::20:
cdrom::21:
input::22:
kvm::23:
nobody::99:
messagebus::81:
users::100:

118
mdev.conf Normal file
View File

@ -0,0 +1,118 @@
# mdev-like-a-boss
# Syntax:
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
#
# [-]: do not stop on this match, continue reading mdev.conf
# =: move, >: move and create a symlink
# !: do not create device node
# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
# support module loading on hotplug
$MODALIAS=.* root:root 660 @modprobe -b "$MODALIAS"
# null may already exist; therefore ownership has to be changed with command
null root:root 666 @chmod 666 $MDEV
zero root:root 666
full root:root 666
random root:root 444
urandom root:root 444
hwrandom root:root 444
grsec root:root 660
# Kernel-based Virtual Machine.
kvm root:kvm 660
# vhost-net, to be used with kvm.
vhost-net root:kvm 660
kmem root:root 640
mem root:root 640
port root:root 640
# console may already exist; therefore ownership has to be changed with command
console root:tty 600 @chmod 600 $MDEV
ptmx root:tty 666
pty.* root:tty 660
# Typical devices
tty root:tty 666
tty[0-9]* root:tty 660
vcsa*[0-9]* root:tty 660
ttyS[0-9]* root:tty 660
# block devices
ram([0-9]*) root:disk 660 >rd/%1
loop([0-9]+) root:disk 660 >loop/%1
sd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
vd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
hd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
md[0-9]* root:disk 660 */opt/mdev/helpers/storage-device
dm-[0-9]* root:disk 660 */opt/mdev/helpers/storage-device
bcache[0-9]* root:disk 660 */opt/mdev/helpers/storage-device
mmcblk[0-9].* root:disk 660 */opt/mdev/helpers/storage-device
sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
fd[0-9]* root:floppy 660
# Run settle-nics every time new NIC appear.
# If you don't want to auto-populate /etc/mactab with NICs, run 'settle-nis' without '--write-mactab' param.
-SUBSYSTEM=net;DEVPATH=.*/net/.*;.* root:root 600 @/opt/mdev/helpers/settle-nics --write-mactab
net/tun[0-9]* root:kvm 660
net/tap[0-9]* root:root 600
# alsa sound devices and audio stuff
SUBSYSTEM=sound;.* root:audio 660 @/opt/mdev/helpers/sound-control
adsp root:audio 660 >sound/
audio root:audio 660 >sound/
dsp root:audio 660 >sound/
mixer root:audio 660 >sound/
sequencer.* root:audio 660 >sound/
# raid controllers
cciss!(.*) root:disk 660 =cciss/%1
ida!(.*) root:disk 660 =ida/%1
rd!(.*) root:disk 660 =rd/%1
fuse root:root 666
card[0-9] root:video 660 =dri/
agpgart root:root 660 >misc/
psaux root:root 660 >misc/
rtc root:root 664 >misc/
# input stuff
SUBSYSTEM=input;.* root:input 660
# v4l stuff
vbi[0-9] root:video 660 >v4l/
video[0-9] root:video 660 >v4l/
# dvb stuff
dvb.* root:video 660
# drm etc
dri/.* root:video 660
# Don't create old usbdev* devices.
usbdev[0-9].[0-9]* root:root 660 !
# Stop creating x:x:x:x which looks like /dev/dm-*
[0-9]+\:[0-9]+\:[0-9]+\:[0-9]+ root:root 660 !
# /dev/cpu support.
microcode root:root 600 =cpu/
cpu([0-9]+) root:root 600 =cpu/%1/cpuid
msr([0-9]+) root:root 600 =cpu/%1/msr
# Populate /dev/bus/usb.
SUBSYSTEM=usb;DEVTYPE=usb_device;.* root:root 660 */opt/mdev/helpers/dev-bus-usb
# Catch-all other devices, Right now useful only for debuging.
#.* root:root 660 */opt/mdev/helpers/catch-all

8
passwd Normal file
View File

@ -0,0 +1,8 @@
root:x:0:0:root:/root:/usr/bin/zsh
bin:x:1:1:bin:/bin:
daemon:x:2:2:daemon:/sbin:
mail:x:8:12:mail:/var/spool/mail:
ftp:x:14:11:ftp:/var/ftp:
www:x:15:15:www:/var/www:/bin/false
messagebus:x:81:81::/var/empty:/bin/false
nobody:x:99:99:nobody:/:

50
rc
View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc: system boot script # /etc/rc: system boot script
# #
@ -8,21 +8,16 @@ echo "The system is coming up. Please wait."
# Load configuration # Load configuration
. /etc/rc.conf . /etc/rc.conf
/bin/mount -t proc none /proc
/bin/mount -t sysfs none /sys
/bin/mount -t devtmpfs none /dev
# Start udev # Start udev
/sbin/mdev -s /sbin/mdev -s
echo "/sbin/mdev" > /proc/sys/kernel/hotplug if [ -e /proc/sys/kernel/hotplug ]; then
# Those two seem to be already mounted at this point on Alpine. echo "hotplug: mdev"
# FIXME: I have no idea why. Who does that? kernel config? kernel parameters? echo "/sbin/mdev" > /proc/sys/kernel/hotplug
#/bin/mount -t proc none /proc fi
#/bin/mount -t sysfs none /sys
# FIXME: Should probably be replaced by mdev or something... right?
#/sbin/start_udev
# FIXME: this loads kernel drivers. Not sure it should be here, but... may it should?
# FIXME: this also makes the system rely on /usr/bin to be bootable. blergh
/usr/bin/find /sys -name modalias -type f -print0 | xargs -0 sort -u \
| /usr/bin/xargs modprobe -b -a 2> /dev/null
# Create device-mapper device nodes and scan for LVM volume groups # Create device-mapper device nodes and scan for LVM volume groups
if [ -x /sbin/lvm ]; then if [ -x /sbin/lvm ]; then
@ -51,7 +46,7 @@ if [ $? -gt 1 ]; then
echo "* *" echo "* *"
echo "************************************************************" echo "************************************************************"
echo echo
/sbin/sulogin -p /sbin/sulogin
echo "Automatic reboot in progress..." echo "Automatic reboot in progress..."
/bin/umount -a -r /bin/umount -a -r
/bin/mount -o remount,ro / /bin/mount -o remount,ro /
@ -77,9 +72,6 @@ fi
# Set kernel variables # Set kernel variables
/sbin/sysctl -p > /dev/null /sbin/sysctl -p > /dev/null
# Update shared library links
/sbin/ldconfig
# Configure host name # Configure host name
if [ "$HOSTNAME" ]; then if [ "$HOSTNAME" ]; then
echo "hostname: $HOSTNAME" echo "hostname: $HOSTNAME"
@ -96,17 +88,23 @@ fi
/sbin/hwclock --hctosys /sbin/hwclock --hctosys
# Load console font # Load console font
# FIXME: Disabled because no font? if [ "$FONT" ]; then
#if [ "$FONT" ]; then echo "font: $FONT"
# echo "font: $FONT" /usr/sbin/setfont $FONT
# /usr/sbin/setfont $FONT fi
#fi
# Load console keymap # Load console keymap
if [ "$KEYMAP" ]; then if [ "$KEYMAP" ]; then
echo "keyboard: $KEYMAP (DISABLED BECAUSE LOADKEYS UNAVAILABLE)" echo "keyboard: $KEYMAP"
#/usr/bin/loadkeys -q $KEYMAP
# zcat "$KEYMAP" | loadkmap local KEYMAP_FILE
if [ -f "$KEYMAP" ]; then
KEYMAP_FILE="$KEYMAP"
else
KEYMAP_FILE=/usr/share/kbd/keymaps/$KEYMAP.map.gz
fi
zcat $KEYMAP_FILE | loadkmap
fi fi
# Screen blanks after 15 minutes idle time # Screen blanks after 15 minutes idle time

View File

@ -2,11 +2,11 @@
# /etc/rc.conf: system configuration # /etc/rc.conf: system configuration
# #
FONT=default #FONT=default
KEYMAP=us #KEYMAP=us
TIMEZONE=UTC #TIMEZONE=UTC
HOSTNAME=host HOSTNAME=host
SYSLOG=sysklogd SYSLOG=sysklogd
SERVICES=(lo crond) SERVICES=()
# End of file # End of file

2
rc.fix
View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc.fix: adjustements startup file (multi-user) # /etc/rc.fix: adjustements startup file (multi-user)
# #

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# /etc/rc.local: local multi-user startup script # /etc/rc.local: local startup script
# #
# End of file # End of file

View File

@ -1,8 +1,12 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc.modules: module initialization script # /etc/rc.modules: module initialization script
# #
/sbin/depmod -a /sbin/depmod -a
# FIXME: Is this even necessary? Is this even *desirable*?
/bin/busybox find /sys -name modalias -type f -print0 | xargs -0 sort -u \
| /bin/bin/busybox xargs modprobe -b -a 2> /dev/null
# End of file # End of file

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc.multi: multi-user startup script # /etc/rc.multi: startup script
# #
# Load configuration # Load configuration
. /etc/rc.conf . /etc/rc.conf

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc.shutdown: system shutdown script # /etc/rc.shutdown: system shutdown script
# #
@ -11,24 +11,22 @@
echo "The system is coming down. Please wait." echo "The system is coming down. Please wait."
if [ "$PREVLEVEL" = "2" ]; then # Shutdown services
# Shutdown services if [ "${SERVICES[*]}" ]; then
if [ "${SERVICES[*]}" ]; then for service in "${SERVICES[@]}"; do
for service in "${SERVICES[@]}"; do R_SERVICES=($service ${R_SERVICES[@]})
R_SERVICES=($service ${R_SERVICES[@]}) done
done for service in "${R_SERVICES[@]}"; do
for service in "${R_SERVICES[@]}"; do /etc/rc.d/$service stop &> /tmp/rc.$$
/etc/rc.d/$service stop &> /tmp/rc.$$ /usr/bin/logger -t $service < /tmp/rc.$$
/usr/bin/logger -t $service < /tmp/rc.$$ /bin/rm -f /tmp/rc.$$
/bin/rm -f /tmp/rc.$$ done
done
fi
fi fi
# Terminate all processes # Terminate all processes
/sbin/killall5 -15 /usr/sbin/killall5 -15
/bin/sleep 5 /bin/sleep 5
/sbin/killall5 -9 /usr/sbin/killall5 -9
# Save random seed # Save random seed
/bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null /bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh
# #
# /etc/rc.single: single-user startup script # /etc/rc.single: single-user startup script
# #

5
sysctl.conf Normal file
View File

@ -0,0 +1,5 @@
#
# /etc/sysctl.conf: configuration for system variables, see sysctl.conf(5)
#
# End of file