From 50357fe1f9ed515695936a9579a7d715ba021b83 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Mon, 19 Aug 2019 19:55:50 +0200 Subject: [PATCH] Updated every file, added a few more. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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. --- group | 27 ++++++++++++ mdev.conf | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++ passwd | 8 ++++ rc | 50 +++++++++++----------- rc.conf | 8 ++-- rc.fix | 2 +- rc.local | 2 +- rc.modules | 6 ++- rc.multi | 5 ++- rc.shutdown | 28 ++++++------- rc.single | 2 +- sysctl.conf | 5 +++ 12 files changed, 210 insertions(+), 51 deletions(-) create mode 100644 group create mode 100644 mdev.conf create mode 100644 passwd create mode 100644 sysctl.conf diff --git a/group b/group new file mode 100644 index 0000000..a69f97d --- /dev/null +++ b/group @@ -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: diff --git a/mdev.conf b/mdev.conf new file mode 100644 index 0000000..9ab69e7 --- /dev/null +++ b/mdev.conf @@ -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 + diff --git a/passwd b/passwd new file mode 100644 index 0000000..3b0f587 --- /dev/null +++ b/passwd @@ -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:/: diff --git a/rc b/rc index b72b388..101be93 100755 --- a/rc +++ b/rc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh # # /etc/rc: system boot script # @@ -8,21 +8,16 @@ echo "The system is coming up. Please wait." # Load configuration . /etc/rc.conf +/bin/mount -t proc none /proc +/bin/mount -t sysfs none /sys +/bin/mount -t devtmpfs none /dev + # Start udev /sbin/mdev -s -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -# Those two seem to be already mounted at this point on Alpine. -# FIXME: I have no idea why. Who does that? kernel config? kernel parameters? -#/bin/mount -t proc none /proc -#/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 +if [ -e /proc/sys/kernel/hotplug ]; then + echo "hotplug: mdev" + echo "/sbin/mdev" > /proc/sys/kernel/hotplug +fi # Create device-mapper device nodes and scan for LVM volume groups if [ -x /sbin/lvm ]; then @@ -51,7 +46,7 @@ if [ $? -gt 1 ]; then echo "* *" echo "************************************************************" echo - /sbin/sulogin -p + /sbin/sulogin echo "Automatic reboot in progress..." /bin/umount -a -r /bin/mount -o remount,ro / @@ -77,9 +72,6 @@ fi # Set kernel variables /sbin/sysctl -p > /dev/null -# Update shared library links -/sbin/ldconfig - # Configure host name if [ "$HOSTNAME" ]; then echo "hostname: $HOSTNAME" @@ -96,17 +88,23 @@ fi /sbin/hwclock --hctosys # Load console font -# FIXME: Disabled because no font? -#if [ "$FONT" ]; then -# echo "font: $FONT" -# /usr/sbin/setfont $FONT -#fi +if [ "$FONT" ]; then + echo "font: $FONT" + /usr/sbin/setfont $FONT +fi # Load console keymap if [ "$KEYMAP" ]; then - echo "keyboard: $KEYMAP (DISABLED BECAUSE LOADKEYS UNAVAILABLE)" - #/usr/bin/loadkeys -q $KEYMAP - # zcat "$KEYMAP" | loadkmap + echo "keyboard: $KEYMAP" + + 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 # Screen blanks after 15 minutes idle time diff --git a/rc.conf b/rc.conf index 938b17f..d51106d 100644 --- a/rc.conf +++ b/rc.conf @@ -2,11 +2,11 @@ # /etc/rc.conf: system configuration # -FONT=default -KEYMAP=us -TIMEZONE=UTC +#FONT=default +#KEYMAP=us +#TIMEZONE=UTC HOSTNAME=host SYSLOG=sysklogd -SERVICES=(lo crond) +SERVICES=() # End of file diff --git a/rc.fix b/rc.fix index cf0dafb..18d3ec8 100755 --- a/rc.fix +++ b/rc.fix @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh # # /etc/rc.fix: adjustements startup file (multi-user) # diff --git a/rc.local b/rc.local index 5e44d98..8f6c40f 100755 --- a/rc.local +++ b/rc.local @@ -1,6 +1,6 @@ #!/bin/bash # -# /etc/rc.local: local multi-user startup script +# /etc/rc.local: local startup script # # End of file diff --git a/rc.modules b/rc.modules index fa08c59..776ae7a 100755 --- a/rc.modules +++ b/rc.modules @@ -1,8 +1,12 @@ -#!/bin/bash +#!/bin/zsh # # /etc/rc.modules: module initialization script # /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 diff --git a/rc.multi b/rc.multi index 998041d..bd48b92 100755 --- a/rc.multi +++ b/rc.multi @@ -1,8 +1,9 @@ -#!/bin/bash +#!/bin/zsh # -# /etc/rc.multi: multi-user startup script +# /etc/rc.multi: startup script # + # Load configuration . /etc/rc.conf diff --git a/rc.shutdown b/rc.shutdown index fec2d88..4a17de8 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh # # /etc/rc.shutdown: system shutdown script # @@ -11,24 +11,22 @@ echo "The system is coming down. Please wait." -if [ "$PREVLEVEL" = "2" ]; then - # Shutdown services - if [ "${SERVICES[*]}" ]; then - for service in "${SERVICES[@]}"; do - R_SERVICES=($service ${R_SERVICES[@]}) - done - for service in "${R_SERVICES[@]}"; do - /etc/rc.d/$service stop &> /tmp/rc.$$ - /usr/bin/logger -t $service < /tmp/rc.$$ - /bin/rm -f /tmp/rc.$$ - done - fi +# Shutdown services +if [ "${SERVICES[*]}" ]; then + for service in "${SERVICES[@]}"; do + R_SERVICES=($service ${R_SERVICES[@]}) + done + for service in "${R_SERVICES[@]}"; do + /etc/rc.d/$service stop &> /tmp/rc.$$ + /usr/bin/logger -t $service < /tmp/rc.$$ + /bin/rm -f /tmp/rc.$$ + done fi # Terminate all processes -/sbin/killall5 -15 +/usr/sbin/killall5 -15 /bin/sleep 5 -/sbin/killall5 -9 +/usr/sbin/killall5 -9 # Save random seed /bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null diff --git a/rc.single b/rc.single index 07c2f51..9df0203 100755 --- a/rc.single +++ b/rc.single @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh # # /etc/rc.single: single-user startup script # diff --git a/sysctl.conf b/sysctl.conf new file mode 100644 index 0000000..48c0484 --- /dev/null +++ b/sysctl.conf @@ -0,0 +1,5 @@ +# +# /etc/sysctl.conf: configuration for system variables, see sysctl.conf(5) +# + +# End of file