summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile21
-rw-r--r--PKGBUILD7
-rw-r--r--RELEASE18
-rwxr-xr-xadjtime (renamed from adjtime.cron)0
-rwxr-xr-xinstall.sh25
-rwxr-xr-xrc15
-rw-r--r--rc.conf6
-rwxr-xr-xrc.multi4
-rwxr-xr-xrc.shutdown6
-rwxr-xr-xrc.single4
-rwxr-xr-xrc.sysinit63
12 files changed, 104 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore
index 48f20c7..d07d3f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
minilogd
-*.pkg.tar.*
+minilogd.o
+tags
+*.tar.xz*
+pkg/
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d3a1824
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+VER := $(shell git describe)
+DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin
+
+minilogd: minilogd.o
+
+installdirs:
+ install -dm755 $(foreach DIR, $(DIRS), $(DESTDIR)$(DIR))
+
+install: minilogd installdirs
+ install -m644 -t $(DESTDIR)/etc inittab rc.conf
+ install -m644 -t $(DESTDIR)/etc/rc.d functions
+ install -m755 -t $(DESTDIR)/etc rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit
+ install -m755 -t $(DESTDIR)/etc/cron.hourly adjtime
+ install -m755 -t $(DESTDIR)/etc/rc.d functions hwclock network netfs
+ install -m755 -t $(DESTDIR)/sbin minilogd rc
+
+clean:
+ rm -f minilogd minilogd.o
+
+release:
+ git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz
diff --git a/PKGBUILD b/PKGBUILD
index b7f6f45..79cd475 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -19,5 +19,10 @@ sha256sums=()
build() {
cd ..
- DESTDIR=${pkgdir} ./install.sh
+ make
+}
+
+package() {
+ cd ..
+ make DESTDIR="$pkgdir" install
}
diff --git a/RELEASE b/RELEASE
new file mode 100644
index 0000000..786b286
--- /dev/null
+++ b/RELEASE
@@ -0,0 +1,18 @@
+Releasing
+
+1) create an anotated tag on the format YYYY.MM.X, where YYYY is the year,
+ MM is the month and X is a number starting from 1. E.g.:
+
+ $ git tag -a 2011.04.1
+
+2) create a tarball
+
+ $ make release
+
+3) copy the tarball to gerolde
+
+ $ scp initscripts-YYYY.MM.X.tar.xz gerolde.archlinux.org:/srv/ftp/other/initscripts/
+
+4) check that the PKGBUILD in git is in sync with the PKGBUILD to be released
+
+5) create packages for both arches and push to testing
diff --git a/adjtime.cron b/adjtime
index 8a894f1..8a894f1 100755
--- a/adjtime.cron
+++ b/adjtime
diff --git a/install.sh b/install.sh
deleted file mode 100755
index c70a10e..0000000
--- a/install.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-install -d -m755 ${DESTDIR}/etc/rc.d || exit 1
-install -d -m755 ${DESTDIR}/etc/conf.d || exit 1
-install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ || exit 1
-install -d -m755 ${DESTDIR}/etc/cron.hourly/ || exit 1
-
-for i in inittab rc.conf; do
- install -D -m644 $i ${DESTDIR}/etc/$i || exit 1
-done
-for i in rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit; do
- install -D -m755 $i ${DESTDIR}/etc/$i || exit 1
-done
-
-install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime
-
-install -D -m644 functions ${DESTDIR}/etc/rc.d/functions || exit 1
-for i in hwclock network netfs; do
- install -D -m755 $i ${DESTDIR}/etc/rc.d/$i || exit 1
-done
-
-gcc $CFLAGS -o minilogd minilogd.c || exit 1
-install -D -m755 minilogd ${DESTDIR}/sbin/minilogd || exit 1
-
-install -D -m755 rc ${DESTDIR}/sbin/rc || exit 1
diff --git a/rc b/rc
index 4bb9730..1e64119 100755
--- a/rc
+++ b/rc
@@ -11,10 +11,12 @@ e.g: rc list
rc help
rc start sshd gpm
EOF
+ exit 1
}
-(( $# < 1 )) && usage && exit 1
+(( $# < 1 )) && usage
+declare -i ret=0
case $1 in
help)
usage
@@ -25,15 +27,15 @@ case $1 in
have_daemon "$d" || continue
# print running / stopped satus
if ! ck_daemon "$d"; then
- printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
+ printf "${C_OTHER}[${C_DONE}STARTED${C_OTHER}]"
else
- printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
+ printf "${C_OTHER}[${C_FAIL}STOPPED${C_OTHER}]"
fi
# print auto / manual status
if ! ck_autostart "$d"; then
- printf "${C_OTHER}[${C_DONE}AUTO${C_OTHER}]"
+ printf "${C_OTHER}[${C_DONE}AUTO${C_OTHER}]"
else
- printf "${C_OTHER}[${C_FAIL} ${C_OTHER}]"
+ printf "${C_OTHER}[${C_FAIL} ${C_OTHER}]"
fi
printf " ${C_MAIN}$d${C_CLEAR}\n"
done
@@ -43,9 +45,10 @@ case $1 in
shift
for i; do
[[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
+ (( ret += $? ))
done
esac
-true
+exit $ret
# vim: set ts=2 sw=2 noet:
diff --git a/rc.conf b/rc.conf
index f360e7a..1898aa3 100644
--- a/rc.conf
+++ b/rc.conf
@@ -7,8 +7,8 @@
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
-# DAEMON_LOCALE: Set the locale during daemon startup and during the boot
-# process. If set to 'no', the C locale will be used.
+# DAEMON_LOCALE: If set to 'yes', use $LOCALE as the locale during daemon
+# startup and during the boot process. If set to 'no', the C locale is used.
# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
# in the hardware clock being left untouched (useful for virtualization)
# Note: Using "localtime" is discouraged.
@@ -81,7 +81,7 @@ INTERFACES=(eth0)
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
-
+
# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"
diff --git a/rc.multi b/rc.multi
index 693223d..d8bf126 100755
--- a/rc.multi
+++ b/rc.multi
@@ -26,4 +26,8 @@ fi
run_hook multi_end
+/bin/touch /var/log/boot
+kill `/bin/cat /run/bootlogd.pid`
+/bin/rm /run/bootlogd.pid
+
# vim: set ts=2 sw=2 noet:
diff --git a/rc.shutdown b/rc.shutdown
index 106c3df..f847ddf 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -54,7 +54,11 @@ if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
fi
stat_busy "Unmounting Filesystems"
-/bin/umount -a -r -t noramfs,notmpfs,nosysfs,noproc,nodevtmpfs -O no_netdev
+if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+ /bin/umount -a -r -t nosysfs,noproc,nodevtmpfs,nodevpts -O no_netdev
+else
+ /bin/umount -a -r -t notmpfs,nosysfs,noproc,nodevpts -O no_netdev
+fi
stat_done
# Kill non-root encrypted partition mappings
diff --git a/rc.single b/rc.single
index aab2b58..b9701d5 100755
--- a/rc.single
+++ b/rc.single
@@ -54,5 +54,9 @@ if [[ $RUNLEVEL = 1 ]]; then
exec /sbin/init -t1 S
fi
+/bin/touch /var/log/boot
+kill `/bin/cat /run/bootlogd.pid`
+/bin/rm /run/bootlogd.pid
+
# End of file
# vim: set ts=2 sw=2 noet:
diff --git a/rc.sysinit b/rc.sysinit
index 178d334..92f7787 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -17,7 +17,10 @@ run_hook sysinit_start
# export standard PATH (will be overridden later when /etc/profile is sourced, but is usefull for UDev)
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-# mount /dev, /proc, /sys, /run (the api filesystems)
+# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
+/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
+/bin/mountpoint -q /sys || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
+/bin/mountpoint -q /run || /bin/mount -n -t tmpfs tmpfs /run -o mode=755,size=10M,nosuid,noexec,nodev
if ! /bin/mountpoint -q /dev; then
if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -25,15 +28,21 @@ if ! /bin/mountpoint -q /dev; then
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
fi
fi
-
-/bin/mkdir -p /dev/{pts,shm}
-
-/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
-/bin/mountpoint -q /sys || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
-/bin/mountpoint -q /run || /bin/mount -n -t tmpfs tmpfs /run -o mode=755,size=10M,nosuid,noexec,nodev
+/bin/mkdir -p /run/lock /dev/{pts,shm}
+/bin/chmod 1777 /run/lock
+/bin/mountpoint -q /dev/pts || /bin/mount /dev/pts &> /dev/null \
+ || /bin/mount -n -t devpts devpts /dev/pts -o mode=620,gid=5,nosuid,noexec
+/bin/mountpoint -q /dev/shm || /bin/mount /devshm &> /dev/null \
+ || /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
+
+# remount root ro to allow for fsck later on, we remount now to
+# make sure nothing can open files rw on root which would block a remount
+/bin/findmnt / --options ro &>/dev/null || \
+status "Mounting Root Read-Only" /bin/mount -n -o remount,ro /
# start up our mini logger until syslog takes over
/sbin/minilogd
+/sbin/bootlogd -p /run/bootlogd.pid
# Set console verbosity
for cmdarg in $(< /proc/cmdline); do
@@ -75,15 +84,12 @@ if [[ $HWCLOCK_PARAMS ]]; then
fi
fi
-stat_busy "Starting UDev Daemon"
-echo "" > /sys/kernel/uevent_helper
-/sbin/udevd --daemon
-stat_done
+status "Starting UDev Daemon" /sbin/udevd --daemon
run_hook sysinit_udevlaunched
# Trigger udev uevents
-if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
+if /bin/pidof /sbin/udevd >/dev/null; then
stat_busy "Triggering UDev uevents"
/sbin/udevadm trigger --action=add --type=devices
/sbin/udevadm trigger --action=add --type=subsystems
@@ -93,14 +99,12 @@ fi
# Load modules from the MODULES array defined in rc.conf
mods=${MODULES[@]/!*/}
if [[ $load_modules != off && -f /proc/modules && $mods ]]; then
- stat_busy "Loading Modules"
- /sbin/modprobe --all $mods
- stat_done
+ status "Loading Modules" /sbin/modprobe --all $mods
fi
unset mods
# Wait for udev uevents
-if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
+if /bin/pidof /sbin/udevd >/dev/null; then
status "Waiting for UDev uevents to be processed" \
/sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
fi
@@ -218,8 +222,6 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
fi
fi
-status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
-
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs"
if [[ -x /sbin/fsck ]]; then
@@ -274,8 +276,6 @@ if [[ -x /sbin/fsck ]]; then
stat_done
fi
-/bin/mkdir -p /dev/{pts,shm}
-
stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
@@ -295,12 +295,8 @@ stat_done
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
- stat_busy "Activating monitoring of LVM2 groups"
- if /sbin/vgchange --monitor y >/dev/null; then
- stat_done
- else
- stat_fail
- fi
+ status "Activating monitoring of LVM2 groups" \
+ /sbin/vgchange --monitor y >/dev/null
fi
status "Activating Swap" /sbin/swapon -a
@@ -313,15 +309,15 @@ fi
RANDOM_SEED=/var/lib/misc/random-seed
if [[ -f $RANDOM_SEED ]]; then
- stat_busy "Initializing Random Seed"
- /bin/cat $RANDOM_SEED > /dev/urandom
- stat_done
+ status "Initializing Random Seed" \
+ /bin/cat $RANDOM_SEED > /dev/urandom
fi
stat_busy "Removing Leftover Files"
-/bin/rm -f /etc/{nologin,shutdownpid} /var/lock/* /forcefsck &>/dev/null
-/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
-[[ -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
+/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
+/bin/mountpoint -q /tmp || /bin/rm -rf /tmp/* /tmp/.* &>/dev/null
+[[ ! -L /var/lock ]] && /bin/rm -rf /var/lock/*
+[[ ! -L /var/run && -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
: >| /var/run/utmp
/bin/chmod 0664 /var/run/utmp
/bin/chown root:utmp /var/run/utmp
@@ -338,7 +334,8 @@ fi
# Set the NIS domain name, if necessary
[[ -f /etc/conf.d/nisdomainname ]] && . /etc/conf.d/nisdomainname
if [[ $NISDOMAINNAME ]]; then
- status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname "$NISDOMAINNAME"
+ status "Setting NIS Domain Name: $NISDOMAINNAME" \
+ /bin/nisdomainname "$NISDOMAINNAME"
fi
stat_busy "Setting Locale: ${LOCALE:=en_US}"