From 88b518c3f95df2454cd291728e0c7e77e9d8a875 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 21 Apr 2011 14:04:40 -0500 Subject: Clarify DAEMON_LOCALE description This was horribly worded, in that it seemed like one should put an actual locale value into the variable. In reality it should have been named USE_DAEMON_LOCALE, but since we can't change that now, make it very clear a 'yes' or 'no' is expected and nothing else. [tomegun: removed typo] Signed-off-by: Dan McGee Signed-off-by: Tom Gundersen --- rc.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc.conf b/rc.conf index 7d03a30..e1403e2 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. -- cgit v1.2.3-54-g00ecf From b4aa5db65539a0e4f3fb07dd486a59a296746c8f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 21 Apr 2011 14:05:47 -0500 Subject: Use a Makefile and clean up install file Use a Makefile to compile, rather than a call to gcc in install.sh. This allows make's implict rules to take care of CFLAGS, LDFLAGS, CC, etc. Use `set -e` in the install file rather than needing '|| exit 1' on every single operation. Signed-off-by: Dan McGee Signed-off-by: Tom Gundersen --- .gitignore | 2 ++ Makefile | 4 ++++ install.sh | 24 +++++++++++++----------- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 48f20c7..c601da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ minilogd +minilogd.o +tags *.pkg.tar.* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..520700b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +minilogd: minilogd.o + +clean: + rm -f minilogd minilogd.o diff --git a/install.sh b/install.sh index c70a10e..e469577 100755 --- a/install.sh +++ b/install.sh @@ -1,25 +1,27 @@ #!/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 +set -e + +install -d -m755 ${DESTDIR}/etc/rc.d +install -d -m755 ${DESTDIR}/etc/conf.d +install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ +install -d -m755 ${DESTDIR}/etc/cron.hourly/ for i in inittab rc.conf; do - install -D -m644 $i ${DESTDIR}/etc/$i || exit 1 + install -D -m644 $i ${DESTDIR}/etc/$i 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 + install -D -m755 $i ${DESTDIR}/etc/$i done install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime -install -D -m644 functions ${DESTDIR}/etc/rc.d/functions || exit 1 +install -D -m644 functions ${DESTDIR}/etc/rc.d/functions for i in hwclock network netfs; do - install -D -m755 $i ${DESTDIR}/etc/rc.d/$i || exit 1 + install -D -m755 $i ${DESTDIR}/etc/rc.d/$i done -gcc $CFLAGS -o minilogd minilogd.c || exit 1 -install -D -m755 minilogd ${DESTDIR}/sbin/minilogd || exit 1 +make minilogd +install -D -m755 minilogd ${DESTDIR}/sbin/minilogd -install -D -m755 rc ${DESTDIR}/sbin/rc || exit 1 +install -D -m755 rc ${DESTDIR}/sbin/rc -- cgit v1.2.3-54-g00ecf From d674e2f73db8e2fcc47813bc7117d8a102ede4fa Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Thu, 21 Apr 2011 23:17:27 +0200 Subject: release: automate and document Add a brief description of how to release initscripts. Also automate the creation of the tarball using "make release". Signed-off-by: Tom Gundersen --- .gitignore | 3 ++- Makefile | 8 +++++++- RELEASE | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 RELEASE diff --git a/.gitignore b/.gitignore index c601da6..d07d3f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ minilogd minilogd.o tags -*.pkg.tar.* +*.tar.xz* +pkg/ diff --git a/Makefile b/Makefile index 520700b..0ec54ee 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ -minilogd: minilogd.o +VER:=$(shell sh -c 'git describe') + +minilogd: + minilogd.o clean: rm -f minilogd minilogd.o + +release: + git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz 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 -- cgit v1.2.3-54-g00ecf From c275d4357bdaff09a44b32f79a4e6f42ef190fba Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Fri, 15 Apr 2011 17:25:27 +0200 Subject: Drop old /sys/kernel/uevent_helper This is not used on modern udev system. It's an old legacy. We should drop it. [tomegun: use "status" rather than "stat_busy"] Signed-off-by: Sebastien Luttringer Signed-off-by: Tom Gundersen --- rc.sysinit | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 56a63bc..b38d84a 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -74,10 +74,7 @@ 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 -- cgit v1.2.3-54-g00ecf From 1de599669a643f82ec0f0c7870335620e74b0765 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 22 Apr 2011 00:08:53 +0200 Subject: Cleanup stat_busy vs status Minor cleanups, no functional change. Signed-off-by: Tom Gundersen --- rc.sysinit | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index b38d84a..070d7cf 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -89,9 +89,7 @@ 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 @@ -291,12 +289,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 @@ -309,9 +303,8 @@ 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" @@ -334,7 +327,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}" -- cgit v1.2.3-54-g00ecf From d52e722d1ac4482ed54c8ea56b78a48cea492797 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 22 Apr 2011 00:14:31 +0200 Subject: remove trailing whitespace in rc.conf I win the price for the most trivial patch! Signed-off-by: Allan McRae --- rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc.conf b/rc.conf index e1403e2..f09b413 100644 --- a/rc.conf +++ b/rc.conf @@ -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" -- cgit v1.2.3-54-g00ecf From 4d5148242a90f5cb768a1b88234447acd289c3ca Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 22 Apr 2011 14:29:58 +0200 Subject: removed leftover mkdir Signed-off-by: Tom Gundersen --- rc.sysinit | 2 -- 1 file changed, 2 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 070d7cf..21b4eb1 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -268,8 +268,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 / -- cgit v1.2.3-54-g00ecf From 9ce42645e7568a08e31ea1b2eab4edef0487828c Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 4 Jul 2010 17:16:35 -0300 Subject: umount tmpfs on shutdown if devtmpfs is used This fixes FS#19783. [tomegun: some adjustments: - always umount ramfs as we never mount /dev as ramfs; and - don't umount /dev/pts as it might still be useful.] Signed-off-by: Gerardo Exequiel Pozzi Signed-off-by: Tom Gundersen --- rc.shutdown | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-54-g00ecf From 09c27ea248efebe1e72aa688cb55996dadbbbe29 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 29 Mar 2011 15:14:33 +0200 Subject: /dev: mount /dev/pts and /dev/shm during early boot This has two purposes: 1) it allows boot services like bootlogd (that needs /dev/pts) to be started very early in boot, and 2) by setting the standard options in rc.sysinit rather than in fstab we have control over them and can easily integrate them with other packages and make adjustments to fix bugs. This brings /dev/{pts,shm} into line with how we handle /dev, /proc, /sys and /run. With this patch /dev/{pts,shm} can (and probably should) be removed from the default fstab file, and fstab should only contain entries for the mountpoints the user has specified during install, like /boot, /home and /var. It will now be possible to boot a working system with an empty fstab. If /dev/{pts,shm} is in fstab the mountoptions there will take precedenc over the standard ones. Cc: Pierre Schmitz Signed-off-by: Tom Gundersen --- rc.sysinit | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 21b4eb1..02199b3 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -16,7 +16,7 @@ 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, /dev, /dev/pts and /dev/shm (the api filesystems) 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 @@ -24,12 +24,12 @@ 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 # start up our mini logger until syslog takes over /sbin/minilogd -- cgit v1.2.3-54-g00ecf From a5bdefd41f8ce9ec1be567fcdf8eea20f39fda48 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 1 Apr 2011 15:42:26 +0200 Subject: bootlogd: log messages to console during early boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This saves all the output during boot to /var/log/boot, which makes debugging boot problems much simpler. The logfile contains all the control (color) characters from boot, so some post processing is in order before the log can be read in a nice format (e.g. less should be able to show this nicely in raw mode). Start bootlogd as soon as the required /dev/pts is mounted. When boot is finished (either at the end of rc.multi or rc.single) create the required lof file (/var/log/boot) if it does not exist. This causes bootlogd to flush the log to disk. Finally, send SIGTERM to bootlogd and clean up after it. Idea-and-original-patch-by: Søren Poulsen Tested-by: David Goldstein Signed-off-by: Tom Gundersen --- rc.multi | 4 ++++ rc.single | 4 ++++ rc.sysinit | 1 + 3 files changed, 9 insertions(+) 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.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 02199b3..0dcd76b 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -33,6 +33,7 @@ fi # 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 -- cgit v1.2.3-54-g00ecf From eda191cf78365cc3d15c0b8c0d8f571c69cd059e Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 22 Apr 2011 23:50:59 +0200 Subject: create /run/lock This allows /var/run and /var/lock to be symlinked to /run and /run/lock, respectively. This would be the final step in fixing FS#18157. With /run/lock created early in boot it would be possible for tools like mdadm and lvm2 to use this directory for their locking, and maybe avoid the --sysinit parameter. This would have to be implemented in the respective packages though. Finally, /run/lock is created 1777 just like /var/lock is now. For the future, it might make sense to follow systemd's lead and make it 0755, and then create a subdir /run/lock/lockdev owned by root:lock with permissions 0755. This would improve security and fend agains DoS attacks, but we would have to check carefully what packages are affected. Signed-off-by: Tom Gundersen --- rc.sysinit | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 0dcd76b..497caae 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -16,7 +16,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 /proc, /sys, /dev, /dev/pts and /dev/shm (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 @@ -307,9 +310,10 @@ if [[ -f $RANDOM_SEED ]]; then 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 -- cgit v1.2.3-54-g00ecf From 5fcb5afeb15d0617407abfd5b0827153b632d7c4 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 23 Apr 2011 20:22:23 +0200 Subject: remount root very early This remounts root read-only as early as possible. In FS#23845 we saw an example of what might happen if we boot with root mounted rw and something manages to opens a file read-write on root before we remount read-only. Signed-off-by: Tom Gundersen --- rc.sysinit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 497caae..e102beb 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -34,6 +34,11 @@ fi /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 @@ -216,8 +221,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 -- cgit v1.2.3-54-g00ecf From a2b481098b19e49d8d9143bcaf385fccb9ba08e8 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 23 Apr 2011 11:21:10 -0400 Subject: Use Makefile to replace install.sh If we're going to use a Makefile for minilogd, we might as well use it for everything. This has some moving pieces: * fix minilogd rule: minilogd.o is a target dep not a build rule * rename adjtime.cron => adjtime * fixup PKGBUILD to account for changes Signed-off-by: Tom Gundersen --- Makefile | 17 ++++++++++++++--- PKGBUILD | 7 ++++++- adjtime | 15 +++++++++++++++ adjtime.cron | 15 --------------- install.sh | 27 --------------------------- 5 files changed, 35 insertions(+), 46 deletions(-) create mode 100755 adjtime delete mode 100755 adjtime.cron delete mode 100755 install.sh diff --git a/Makefile b/Makefile index 0ec54ee..d3a1824 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,18 @@ -VER:=$(shell sh -c 'git describe') +VER := $(shell git describe) +DIRS := /etc/rc.d /etc/conf.d /etc/rc.d/functions.d /etc/cron.hourly /sbin -minilogd: - minilogd.o +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 diff --git a/PKGBUILD b/PKGBUILD index 79f51f8..c5f2acd 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/adjtime b/adjtime new file mode 100755 index 0000000..8a894f1 --- /dev/null +++ b/adjtime @@ -0,0 +1,15 @@ +#!/bin/bash +# Update our hwclock for system drift + +. /etc/rc.conf + +HWCLOCK_PARAMS="--adjust" +case $HARDWARECLOCK in + UTC) HWCLOCK_PARAMS+=" --utc";; + localtime) HWCLOCK_PARAMS+=" --localtime";; + *) HWCLOCK_PARAMS="";; +esac + +if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then + /sbin/hwclock $HWCLOCK_PARAMS +fi diff --git a/adjtime.cron b/adjtime.cron deleted file mode 100755 index 8a894f1..0000000 --- a/adjtime.cron +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# Update our hwclock for system drift - -. /etc/rc.conf - -HWCLOCK_PARAMS="--adjust" -case $HARDWARECLOCK in - UTC) HWCLOCK_PARAMS+=" --utc";; - localtime) HWCLOCK_PARAMS+=" --localtime";; - *) HWCLOCK_PARAMS="";; -esac - -if [[ $HWCLOCK_PARAMS && -f /run/daemons/hwclock ]]; then - /sbin/hwclock $HWCLOCK_PARAMS -fi diff --git a/install.sh b/install.sh deleted file mode 100755 index e469577..0000000 --- a/install.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -install -d -m755 ${DESTDIR}/etc/rc.d -install -d -m755 ${DESTDIR}/etc/conf.d -install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ -install -d -m755 ${DESTDIR}/etc/cron.hourly/ - -for i in inittab rc.conf; do - install -D -m644 $i ${DESTDIR}/etc/$i -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 -done - -install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime - -install -D -m644 functions ${DESTDIR}/etc/rc.d/functions -for i in hwclock network netfs; do - install -D -m755 $i ${DESTDIR}/etc/rc.d/$i -done - -make minilogd -install -D -m755 minilogd ${DESTDIR}/sbin/minilogd - -install -D -m755 rc ${DESTDIR}/sbin/rc -- cgit v1.2.3-54-g00ecf From cc199761fcaddae6e1ea9c4bb7f5bfeaf139445e Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 23 Apr 2011 21:01:19 -0400 Subject: rc: exit with a meaningful value --- rc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rc b/rc index 4bb9730..754b69c 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 @@ -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: -- cgit v1.2.3-54-g00ecf From 81489b747d718e80cd0a6115616602ef4137fc40 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 23 Apr 2011 21:01:18 -0400 Subject: rc: fix whitespace in case statement --- rc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc b/rc index 754b69c..1e64119 100755 --- a/rc +++ b/rc @@ -27,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 -- cgit v1.2.3-54-g00ecf From cd0ec05a9682ccaaf8d288ab4685edf1c311ec8f Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sun, 24 Apr 2011 20:45:08 +0200 Subject: pidof: don't use -o %PPID No need to ommit the parent process, as it's name will not coincide with udevd. Original-patch-by: David Reisner Signed-off-by: Tom Gundersen --- rc.sysinit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index e102beb..0dd644e 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -88,7 +88,7 @@ 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 @@ -103,7 +103,7 @@ 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 -- cgit v1.2.3-54-g00ecf