summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-20 17:42:34 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2016-11-25 01:49:36 +0100
commitb0f23d1e562e753cb78a473fdade956a25cc337b (patch)
treefe4a5908d1e39e24ec6df66052e866ed72421a79 /package/base-files/files
parent49a817b44be5695a87f6b4c8eadef3bb0f9419f9 (diff)
finalize systemd as alternative init system
Most important is the fix in patch-src_journal_journald-server_c, which breaks startup of systemd-journald when code is compiled with -DNDEBUG. A lot of base-files reorganizing to only install required files on sysv systems.
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/fstab13
-rw-r--r--package/base-files/files/init.d/cifs39
-rwxr-xr-xpackage/base-files/files/init.d/done4
-rwxr-xr-xpackage/base-files/files/init.d/fs50
-rwxr-xr-xpackage/base-files/files/init.d/kmod12
-rw-r--r--package/base-files/files/init.d/nfs40
-rwxr-xr-xpackage/base-files/files/init.d/rcK34
-rwxr-xr-xpackage/base-files/files/init.d/rcS82
-rw-r--r--package/base-files/files/inittab.sysv14
-rw-r--r--package/base-files/files/inittab.sysvinit4
-rw-r--r--package/base-files/files/mdev.conf18
-rwxr-xr-xpackage/base-files/files/mdev/fs67
12 files changed, 373 insertions, 4 deletions
diff --git a/package/base-files/files/fstab b/package/base-files/files/fstab
new file mode 100644
index 000000000..06f19d9b6
--- /dev/null
+++ b/package/base-files/files/fstab
@@ -0,0 +1,13 @@
+# /etc/fstab: static file system information.
+#<fs> <mount point> <type> <options> <dump> <pass>
+proc /proc proc defaults 0 0
+devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
+tmpfs /dev/shm tmpfs mode=0777 0 0
+tmpfs /tmp tmpfs mode=1777 0 0
+tmpfs /run tmpfs mode=777 0 0
+sysfs /sys sysfs defaults 0 0
+tmpfs /media tmpfs defaults 0 0
+# example for cifs
+#//192.168.1.1/music /media/music cifs ro,password=linux123,username=adk,iocharset=utf8,sec=ntlm 0 0
+# example for read-only ntfs with UUID
+#UUID=E4BC628CBC6258D6 /media/usb ntfs ro,fmask=022,dmask=022 0 0
diff --git a/package/base-files/files/init.d/cifs b/package/base-files/files/init.d/cifs
new file mode 100644
index 000000000..b3ca9c649
--- /dev/null
+++ b/package/base-files/files/init.d/cifs
@@ -0,0 +1,39 @@
+#!/bin/sh
+#INIT 60
+
+case $1 in
+autostop) ;;
+autostart)
+ exec sh $0 start
+ ;;
+start)
+ grep -v "^#" /etc/fstab | grep cifs >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ grep cifs /proc/filesystems >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ mntpoints=$(grep -v "^#" /etc/fstab| grep cifs|awk '{ print $2 }')
+ for mntpoint in $mntpoints; do
+ mkdir -p $mntpoint
+ done
+ mount -a -t cifs
+ else
+ logger -s -t cifs "No cifs support in kernel"
+ fi
+ fi
+ ;;
+stop)
+ grep -v "^#" /etc/fstab| grep cifs >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ umount -a -t cifs
+ fi
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/base-files/files/init.d/done b/package/base-files/files/init.d/done
new file mode 100755
index 000000000..04950fdc2
--- /dev/null
+++ b/package/base-files/files/init.d/done
@@ -0,0 +1,4 @@
+#!/bin/sh
+#INIT 98
+[[ $1 = autostart ]] && sysctl -p >&- 2>/dev/null
+exit 0
diff --git a/package/base-files/files/init.d/fs b/package/base-files/files/init.d/fs
new file mode 100755
index 000000000..55e2c3449
--- /dev/null
+++ b/package/base-files/files/init.d/fs
@@ -0,0 +1,50 @@
+#!/bin/sh
+#INIT 10
+[[ $1 = autostart ]] || exit 0
+
+# activate swap
+[ -x /sbin/swapon ] && {
+ grep swap /etc/fstab >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ logger -t 'SWAP' "Activating swap"
+ swapon -a
+ fi
+}
+
+# activate any logical volumes
+[ -x /usr/sbin/lvm ] && {
+ logger -t 'LVM' "Activating LVM volumes"
+ lvm vgscan
+ lvm vgchange -ay
+}
+
+# mount local filesystems
+fstypes="ext2 ext3 ext4 xfs vfat ntfs ntfs-3g"
+for fs in $fstypes; do
+ procfs=$fs
+ if [ $fs = "ntfs-3g" ];then
+ procfs=fuse
+ fi
+ disks=$(grep -v "^#" /etc/fstab|grep "${fs}[[:blank:]]"|awk '{ print $1 }')
+ for disk in $disks; do
+ logger -t 'Filesystem' "Found $disk with filesystem $fs"
+ mnt=$(grep -v "^#" /etc/fstab|grep "${disk}[[:blank:]]"|awk '{ print $2 }')
+ grep $procfs /proc/filesystems >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ [ -x /usr/sbin/fsck.$fs ] && {
+ logger -t 'Filesystem' "checking $fs filesystem on $disk"
+ fsck -p $disk >/dev/null 2>&1
+ }
+ mkdir -p $mnt > /dev/null 2>&1
+ if [ -b $disk ]; then
+ logger -t 'Filesystem' "Mounting $disk to $mnt"
+ mount $disk
+ else
+ logger -t 'Filesystem' "Skipping mounting $disk, device file missing"
+ fi
+ else
+ logger -t 'Filesystem' "No $procfs filesystem in kernel"
+ fi
+ done
+done
+exit 0
diff --git a/package/base-files/files/init.d/kmod b/package/base-files/files/init.d/kmod
new file mode 100755
index 000000000..509496a9e
--- /dev/null
+++ b/package/base-files/files/init.d/kmod
@@ -0,0 +1,12 @@
+#!/bin/sh
+#INIT 15
+[[ $1 = autostart ]] || exit 0
+
+. /etc/functions.sh
+
+load_modules /etc/modules
+for f in /etc/modules.d/*; do
+ [[ -e $f ]] && load_modules /etc/modules.d/*
+ break
+done
+exit 0
diff --git a/package/base-files/files/init.d/nfs b/package/base-files/files/init.d/nfs
new file mode 100644
index 000000000..4c3f9ba83
--- /dev/null
+++ b/package/base-files/files/init.d/nfs
@@ -0,0 +1,40 @@
+#!/bin/sh
+#INIT 60
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${rpcbind:-NO}" = x"NO" && exit 0
+ exec sh $0 start
+ ;;
+start)
+ grep -v "^#" /etc/fstab| grep nfs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ grep nfs /proc/filesystems >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mkdir -p /var/lib/nfs/rpc_pipefs
+ mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
+ mount -a -t nfs
+ else
+ logger -t nfs "No nfs support in kernel"
+ fi
+ fi
+ ;;
+stop)
+ grep -v "^#" /etc/fstab| grep nfs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ umount -a -t nfs
+ umount /var/lib/nfs/rpc_pipefs
+ fi
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/base-files/files/init.d/rcK b/package/base-files/files/init.d/rcK
new file mode 100755
index 000000000..8bff46cc6
--- /dev/null
+++ b/package/base-files/files/init.d/rcK
@@ -0,0 +1,34 @@
+#!/bin/sh
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+: ${rcquiet=0}
+if test x"$rcquiet" = x"0" && sh -n /etc/rc.conf >/dev/null 2>&1; then
+ . /etc/rc.conf
+ unset rcquiet
+ rcquiet=0
+else
+ unset rcquiet
+ rcquiet=1
+fi
+{
+ grep '^#INIT ' /etc/init.d/* | \
+ sort -rnk2 | \
+ while read line; do
+ rcenabled=NO
+ rcname=${line%%:*}
+ rcname=${rcname##*/}
+ test x"$rcquiet" = x"0" && eval 'rcenabled=${'"${rcname}"':-NO}'
+ test x"$rcenabled" = x"NO" || echo -n "Stopping ${rcname}... "
+ sh ${line%%:*} autostop
+ rc=$?
+ case $rcenabled:$rc in
+ (NO:*)
+ ;;
+ (*:0)
+ echo done.
+ ;;
+ (*:*)
+ echo "failed ($rc)."
+ ;;
+ esac
+ done
+} | logger -s -p 6 -t ''
diff --git a/package/base-files/files/init.d/rcS b/package/base-files/files/init.d/rcS
new file mode 100755
index 000000000..bc27ed29c
--- /dev/null
+++ b/package/base-files/files/init.d/rcS
@@ -0,0 +1,82 @@
+#!/bin/sh
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+# disable kernel messages
+if [ -f /proc/sys/kernel/printk ];then
+ echo 0 > /proc/sys/kernel/printk
+fi
+ln -s /proc/self/fd/0 /dev/stdin
+ln -s /proc/self/fd/1 /dev/stdout
+ln -s /proc/self/fd/2 /dev/stderr
+: ${rcquiet=0}
+if [ $rcquiet -ne 1 ];then
+ echo "System initialization ..."
+fi
+
+# create some useful directories in tmpfs
+mkdir -p /var/log
+mkdir -p /var/run
+mkdir -p /var/tmp
+touch /var/log/lastlog
+touch /var/log/wtmp
+
+# start dynamic device node management
+[ -f /etc/init.d/rcdev ] && . /etc/init.d/rcdev
+
+# seed some random
+cat /etc/.rnd >/dev/urandom 2>&1
+
+# setup cfgfs
+[ -x /sbin/cfgfs ] && {
+ cfgfs setup
+ mount -o remount,ro /
+}
+
+# remount /tmp with smaller size
+size=$(cat /etc/tmpfs 2>/dev/null)
+[ -z $size ] && size=2048
+mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp
+
+HOSTNAME=
+[[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname)
+HOSTNAME=${HOSTNAME%%.*}
+echo ${HOSTNAME:=openadk} >/proc/sys/kernel/hostname
+
+chown 0:0 /tmp; chmod 1777 /tmp
+
+if test x"$rcquiet" = x"0" && sh -n /etc/rc.conf >/dev/null 2>&1; then
+ . /etc/rc.conf
+ unset rcquiet
+ rcquiet=0
+else
+ unset rcquiet
+ rcquiet=1
+fi
+{
+ grep '^#INIT ' /etc/init.d/* | \
+ sort -nk2 | \
+ while read line; do
+ rcenabled=NO
+ rcname=${line%%:*}
+ rcname=${rcname##*/}
+ test x"$rcquiet" = x"0" && eval 'rcenabled=${'"${rcname}"':-NO}'
+ test x"$rcenabled" = x"NO" || echo -n "Starting ${rcname}... "
+ sh ${line%%:*} autostart
+ rc=$?
+ case $rcenabled:$rc in
+ (NO:*)
+ ;;
+ (*:0)
+ echo done.
+ ;;
+ (*:*)
+ echo "failed ($rc)."
+ ;;
+ esac
+ done
+} |tee /dev/stderr |logger -p 6 -t ''
+
+if [ $rcquiet -ne 1 ]; then
+ if [ -f /etc/rc.netinfo ]; then
+ . /etc/rc.netinfo
+ fi
+fi
diff --git a/package/base-files/files/inittab.sysv b/package/base-files/files/inittab.sysv
index edfe9dc94..f1fd8b126 100644
--- a/package/base-files/files/inittab.sysv
+++ b/package/base-files/files/inittab.sysv
@@ -1,4 +1,10 @@
-id:2:initdefault:
-si::sysinit:/etc/init.d/rcS
-1:234:respawn:/sbin/agetty 115200 tty1
-AMA0:3:respawn:/sbin/agetty -L 9600 ttyAMA0 vt320
+null::sysinit:/bin/mount -t proc proc /proc
+null::sysinit:/bin/mount -t sysfs sys /sys
+null::sysinit:/bin/mkdir -p /dev/pts
+null::sysinit:/bin/mkdir -p /dev/shm
+null::sysinit:/bin/mount -a -t devpts
+null::sysinit:/bin/mount -a -t tmpfs
+::sysinit:/etc/init.d/rcS
+::shutdown:/etc/init.d/rcK
+null::shutdown:/bin/umount -a
+null::shutdown:/sbin/swapoff -a
diff --git a/package/base-files/files/inittab.sysvinit b/package/base-files/files/inittab.sysvinit
new file mode 100644
index 000000000..edfe9dc94
--- /dev/null
+++ b/package/base-files/files/inittab.sysvinit
@@ -0,0 +1,4 @@
+id:2:initdefault:
+si::sysinit:/etc/init.d/rcS
+1:234:respawn:/sbin/agetty 115200 tty1
+AMA0:3:respawn:/sbin/agetty -L 9600 ttyAMA0 vt320
diff --git a/package/base-files/files/mdev.conf b/package/base-files/files/mdev.conf
new file mode 100644
index 000000000..179222221
--- /dev/null
+++ b/package/base-files/files/mdev.conf
@@ -0,0 +1,18 @@
+null 0:0 777
+zero 0:0 666
+u?random 0:0 644
+console 0:0 600
+ptmx 0:0 666
+tty 0:0 666
+tty[0-9]* 0:0 666
+ttyS* 0:0 640
+rtc0 root:root 660 @ln -sf /dev/rtc0 /dev/rtc
+device-mapper 0:0 660 @test -d /dev/mapper || mkdir /dev/mapper
+tun 0:0 660 >net/tun
+fb0 root:video 660
+snd/timer root:audio 660
+snd/controlC0 root:audio 660
+snd/pcmC0D0p root:audio 660
+snd/pcmC0D1p root:audio 660
+msr0 root:root 660 @(mkdir -p /dev/cpu/0 && ln -sf /dev/msr0 /dev/cpu/0/msr)
+sd[a-z][1-9]* root:root 660 */etc/mdev/fs
diff --git a/package/base-files/files/mdev/fs b/package/base-files/files/mdev/fs
new file mode 100755
index 000000000..86c4cee2f
--- /dev/null
+++ b/package/base-files/files/mdev/fs
@@ -0,0 +1,67 @@
+#!/bin/sh
+# skip root disk here, will be handled in /etc/init.d/fs
+rootdisk=$(readlink /dev/root)
+if [ "x${rootdisk}" = "x${MDEV}" ];then
+ exit 0
+fi
+uuid=$(blkid /dev/${MDEV} | sed -n '/^.*UUID="\([^"]*\)".*$/s//\1/p')
+if [ -z $uuid ];then
+ fs=$(grep "^/dev/${MDEV}[[:blank:]]" /etc/fstab | awk '{ print $3 }')
+ mnt=$(grep "^/dev/${MDEV}[[:blank:]]" /etc/fstab | awk '{ print $2 }')
+ disk="${MDEV}"
+else
+ fs=$(grep "^/dev/${MDEV}[[:blank:]]\|^UUID=$uuid" /etc/fstab | awk '{ print $3 }')
+ mnt=$(grep "^/dev/${MDEV}[[:blank:]]\|^UUID=$uuid" /etc/fstab | awk '{ print $2 }')
+ disk="${MDEV} (${uuid})"
+fi
+if [ -z $fs ];then
+ logger -t mdev "Disk $disk not registered in /etc/fstab"
+ exit 0
+fi
+
+procfs=$fs
+if [ $fs = "ntfs-3g" ];then
+ procfs=fuse
+fi
+
+# check if already mounted via /etc/init.d/fs
+adk_check() {
+ mount | grep "${MDEV}[[:blank:]]"
+ if [ $? -eq 0 ];then
+ logger -t mdev "Filesystem on ${MDEV} already mounted"
+ exit 0
+ fi
+}
+
+# filesystem check
+adk_fsck() {
+ [ -x /usr/sbin/fsck.$fs ] && {
+ logger -t mdev "Checking $fs filesystem on ${MDEV}"
+ fsck -p ${MDEV} >/dev/null
+ }
+}
+
+# mount filesystem
+adk_mount() {
+ mkdir -p $mnt >/dev/null 2>&1
+ grep $procfs /proc/filesystems >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ logger -t mdev "Mounting $disk to $mnt"
+ mount $mnt 2>> /tmp/mount.err
+ if [ $? -ne 0 ]; then
+ logger -t mdev "Mounting $disk failed with $?"
+ fi
+ else
+ logger -t mdev "Required filesystem $procfs not available"
+ fi
+}
+
+case "${ACTION}" in
+add)
+ logger -t mdev "Device ${MDEV} added to the system"
+ adk_check
+ adk_fsck
+ adk_mount
+ ;;
+esac
+exit 0