Obsolete
/
recipes
Archived
3
0
Fork 0

rc: recipe bump, deprecates previous dedicated repository

master
Luka Vandervelden 2019-08-26 17:55:55 +02:00
parent 20b0bca898
commit 8ab9c05983
14 changed files with 514 additions and 3 deletions

27
rc/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:

19
rc/inittab Normal file
View File

@ -0,0 +1,19 @@
#
# /etc/inittab: init(8) configuration.
#
::sysinit:/etc/rc
::wait:/etc/rc.multi
::shutdown:/etc/rc.shutdown
tty1::respawn:/sbin/getty 38400 tty1 linux
tty2::respawn:/sbin/getty 38400 tty2 linux
tty3::respawn:/sbin/getty 38400 tty3 linux
tty4::respawn:/sbin/getty 38400 tty4 linux
tty5::respawn:/sbin/getty 38400 tty5 linux
tty6::respawn:/sbin/getty 38400 tty6 linux
::respawn:/sbin/getty 38400 ttyS0 vt100
::ctrlaltdel:/sbin/reboot
# End of file

118
rc/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
rc/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:/:

121
rc/rc Executable file
View File

@ -0,0 +1,121 @@
#!/bin/zsh
#
# /etc/rc: system boot script
#
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
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
/sbin/vgscan --mknodes --ignorelockingfailure
/sbin/vgchange --sysinit -a y
fi
# Mount root read-only
/bin/mount -o remount,ro /
if [ -f /forcefsck ]; then
FORCEFSCK="-f"
fi
# Check filesystems
/sbin/fsck $FORCEFSCK -A -T -a
if [ $? -gt 1 ]; then
echo
echo "*************** FILESYSTEM CHECK FAILED ******************"
echo "* *"
echo "* Please repair manually and reboot. Note that the root *"
echo "* file system is currently mounted read-only. To remount *"
echo "* it read-write type: mount -n -o remount,rw / *"
echo "* When you exit the maintainance shell the system will *"
echo "* reboot automatically. *"
echo "* *"
echo "************************************************************"
echo
/sbin/sulogin
echo "Automatic reboot in progress..."
/bin/umount -a -r
/bin/mount -o remount,ro /
/sbin/reboot -f
exit 0
fi
# Mount local filesystems
/bin/mount -o remount,rw /
/bin/mount -a -O no_netdev
# Activate swap
/sbin/swapon -a
# Clean up misc files
: > /var/run/utmp
/bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid
(cd /var/run && /usr/bin/find . -name "*.pid" -delete)
(cd /var/lock && /usr/bin/find . ! -type d -delete)
(cd /tmp && /usr/bin/find . ! -name . -delete)
/bin/mkdir -m 1777 /tmp/.ICE-unix
# Set kernel variables
/sbin/sysctl -p > /dev/null
# Configure host name
if [ "$HOSTNAME" ]; then
echo "hostname: $HOSTNAME"
/bin/hostname $HOSTNAME
fi
# Load random seed
/bin/cat /var/lib/urandom/seed > /dev/urandom
# Configure system clock
if [ "$TIMEZONE" ]; then
/bin/ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
/sbin/hwclock --hctosys
# Load console font
if [ "$FONT" ]; then
echo "font: $FONT"
/usr/sbin/setfont $FONT
fi
# Load console keymap
if [ "$KEYMAP" ]; then
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
#/usr/bin/setterm -blank 15
# Run module initialization script
if [ -x /etc/rc.modules ]; then
/etc/rc.modules
fi
# Save boot messages
/bin/dmesg > /var/log/boot
# End of file

12
rc/rc.conf Normal file
View File

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

24
rc/rc.fix Executable file
View File

@ -0,0 +1,24 @@
#!/bin/zsh
#
# /etc/rc.fix: adjustements startup file (multi-user)
#
#######################################################################
# X11 font-related checks
#######################################################################
if [ -d /usr/share/fonts/X11 ]; then
for i in `/bin/ls -d /usr/share/fonts/X11/*`; do
if [ ! -f $i/fonts.dir ]; then
mkfontdir $i &> /dev/null
mkfontscale $i &> /dev/null
fi
done
fi
if [ -d /var/cache/fontconfig ] && [ -z "`/bin/ls /var/cache/fontconfig/`" ]; then
fc-cache --system-only &> /dev/null
fi
# End of file

6
rc/rc.local Executable file
View File

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

12
rc/rc.modules Executable file
View File

@ -0,0 +1,12 @@
#!/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

36
rc/rc.multi Executable file
View File

@ -0,0 +1,36 @@
#!/bin/zsh
#
# /etc/rc.multi: startup script
#
# Load configuration
. /etc/rc.conf
# Run fixes startup file
if [ -x /etc/rc.fix ]; then
/etc/rc.fix
fi
# Start services
if [ "$SYSLOG" -o "${SERVICES[*]}" ]; then
echo -n "starting services:"
if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then
echo -n " $SYSLOG"
/etc/rc.d/$SYSLOG start &> /dev/null || echo -n "[ERROR]"
fi
for service in ${SERVICES[@]}; do
echo -n " $service"
/etc/rc.d/$service start &> /tmp/rc.$$ || echo -n "[ERROR]"
/usr/bin/logger -t $service < /tmp/rc.$$
/bin/rm -f /tmp/rc.$$
done
echo
fi
# Run local startup script
if [ -x /etc/rc.local ]; then
/etc/rc.local
fi
# End of file

60
rc/rc.shutdown Executable file
View File

@ -0,0 +1,60 @@
#!/bin/zsh
#
# /etc/rc.shutdown: system shutdown script
#
# Load configuration
. /etc/rc.conf
# Set linefeed mode to avoid staircase effect
/bin/stty onlcr
echo "The system is coming down. Please wait."
# 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
/usr/sbin/killall5 -15
/bin/sleep 5
/usr/sbin/killall5 -9
# Save random seed
/bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null
# Save system clock
/sbin/hwclock --systohc
# Write to wtmp file before unmounting
/sbin/halt -w
# Turn off swap
/sbin/swapoff -a
# Unmount file systems
/bin/umount -a -d -r -t nosysfs,noproc,nodevtmpfs
if [ -x /sbin/lvm ]; then
/sbin/vgchange --ignorelockingfailure -a n
fi
/bin/umount -a -r
# Remount root filesystem read-only
/bin/mount -o remount,ro /
# Power off or reboot
if [ "$RUNLEVEL" = "0" ]; then
/sbin/poweroff -d -f -i
else
/sbin/reboot -d -f -i
fi
# End of file

49
rc/rc.single Executable file
View File

@ -0,0 +1,49 @@
#!/bin/zsh
#
# /etc/rc.single: single-user startup script
#
# Load configuration
. /etc/rc.conf
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 -f /tmp/rc.$$
/bin/rm -f /tmp/rc.$$
done
fi
fi
if [ "$PREVLEVEL" != "N" ]; then
# Terminate all processes
/sbin/killall5 -15
/bin/sleep 5
/sbin/killall5 -9
if ! /bin/mountpoint -q /proc ; then
/bin/mount -n -t proc none /proc
fi
if ! /bin/mountpoint -q /sys ; then
/bin/mount -n -t sysfs none /sys
fi
# Start udev
/sbin/start_udev
if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then
/etc/rc.d/$SYSLOG start &> /dev/null
fi
fi
if [ "$RUNLEVEL" = "1" ]; then
# Enter single-user mode
exec /sbin/init -t1 S
fi
# End of file

View File

@ -1,7 +1,21 @@
name: rc
version: 0.0.1
version: 0.0.2
release: 1
sources: https://git.karchnu.fr/JunkOS/rc/archive/579e431144e33b2510260b1bce5505fd328d2961.tar.gz
sources:
- group
- inittab
- mdev.conf
- passwd
- rc
- rc.conf
- rc.fix
- rc.local
- rc.modules
- rc.multi
- rc.shutdown
- rc.single
- sysctl.conf
@configure
true
@ -13,4 +27,4 @@ sources: https://git.karchnu.fr/JunkOS/rc/archive/579e431144e33b2510260b1bce5505
mkdir -p '%{pkg}/sys'
mkdir -p '%{pkg}/dev'
mkdir -p '%{pkg}/etc'
cp rc/* '%{pkg}/etc/'
cp * '%{pkg}/etc/'

5
rc/sysctl.conf Normal file
View File

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