diff options
author | Arjan Bouter | 2011-03-31 22:30:35 +0200 |
---|---|---|
committer | Arjan Bouter | 2011-03-31 22:30:35 +0200 |
commit | 79ac26ba6ca3bfe6bb456882abb0a9b91874d62b (patch) | |
tree | 29c1c37f3b523fb5042600097f07e62dce393d5a | |
parent | 1b49fbb05cb7255e518d8b782ab9ece4aca703dd (diff) |
smgl-upstart: dropped sysv-compat mode and revised init scripts
84 files changed, 625 insertions, 709 deletions
diff --git a/smgl/smgl-upstart/CONFIGURE b/smgl/smgl-upstart/CONFIGURE deleted file mode 100755 index 9b0c7d3f5a..0000000000 --- a/smgl/smgl-upstart/CONFIGURE +++ /dev/null @@ -1,4 +0,0 @@ -message "sysvcompat, copied from ubuntu is currently broken on SMGL" && -message "native is created from scratch for Source Mage GNU/Linux" && -message "so use native unless you feel like fixing sysvcompat" && -config_query_list UPSTART_INIT "Choose upstart init-mode mode:" native sysvcompat diff --git a/smgl/smgl-upstart/DEPENDS b/smgl/smgl-upstart/DEPENDS index 41a516fc6e..1361d5ff83 100755 --- a/smgl/smgl-upstart/DEPENDS +++ b/smgl/smgl-upstart/DEPENDS @@ -1,2 +1,2 @@ depends upstart && -depends GETTY +depends util-linux diff --git a/smgl/smgl-upstart/DETAILS b/smgl/smgl-upstart/DETAILS index 1b65f57af7..511d5de2df 100755 --- a/smgl/smgl-upstart/DETAILS +++ b/smgl/smgl-upstart/DETAILS @@ -1,5 +1,5 @@ SPELL=smgl-upstart - VERSION=0.1 + VERSION=0.2 WEB_SITE=http://www.sourcemage.org ENTERED=20090907 LICENSE[0]=GPL diff --git a/smgl/smgl-upstart/HISTORY b/smgl/smgl-upstart/HISTORY index 6c3aa1fced..e2c2cb4217 100644 --- a/smgl/smgl-upstart/HISTORY +++ b/smgl/smgl-upstart/HISTORY @@ -1,3 +1,7 @@ +2011-03-31 Arjan Bouter <abouter@sourcemage.org> + * dropped sysv-compat support + * added revised native init scripts + 2009-09-15 Arjan Bouter <abouter@sourcemage.org> * improved the native init scripts diff --git a/smgl/smgl-upstart/INSTALL b/smgl/smgl-upstart/INSTALL index d4ff75a598..d92e2d08c9 100755 --- a/smgl/smgl-upstart/INSTALL +++ b/smgl/smgl-upstart/INSTALL @@ -1,4 +1,4 @@ UPSTART_DIR="${INSTALL_ROOT}/etc/init" && mkdir -p ${UPSTART_DIR} && -cp -r ${SCRIPT_DIRECTORY}/upstart-init/${UPSTART_INIT}/* ${UPSTART_DIR} && -install_config_file ${SCRIPT_DIRECTORY}/inittab.${UPSTART_INIT} ${INSTALL_ROOT}/etc/inittab +cp -r ${SCRIPT_DIRECTORY}/upstart-init/* ${UPSTART_DIR} && +install_config_file ${SCRIPT_DIRECTORY}/inittab ${INSTALL_ROOT}/etc/inittab diff --git a/smgl/smgl-upstart/inittab.native b/smgl/smgl-upstart/inittab index ccb906e810..ccb906e810 100644 --- a/smgl/smgl-upstart/inittab.native +++ b/smgl/smgl-upstart/inittab diff --git a/smgl/smgl-upstart/inittab.sysvcompat b/smgl/smgl-upstart/inittab.sysvcompat deleted file mode 100644 index 23b5324226..0000000000 --- a/smgl/smgl-upstart/inittab.sysvcompat +++ /dev/null @@ -1,17 +0,0 @@ -bootprog = rc -# change this to switch to your own upstart init-scripts -fileprefix = /etc/init -PATH = /sbin:/bin:/usr/sbin:/usr/bin -INIT_PATH = sysvcompat - -tty1:linux:/sbin/agetty /dev/tty1 9600 -tty2:linux:/sbin/agetty /dev/tty2 9600 -tty3:linux:/sbin/agetty /dev/tty3 9600 -tty4:linux:/sbin/agetty /dev/tty4 9600 -tty5:linux:/sbin/agetty /dev/tty5 9600 -tty6:linux:/sbin/agetty /dev/tty6 9600 - -finalprog = -quietrollback = yes -#ctrlaltdel = /bin/sh -c "PATH=$INIT_ROOT:$PATH; echo $'\\a\\nAuf Wiedersehen!\\n' ; initctl -u -r -f" -ctrlaltdel =/sbin/shutdown -r now diff --git a/smgl/smgl-upstart/upstart-init/README b/smgl/smgl-upstart/upstart-init/README new file mode 100644 index 0000000000..42ae758f73 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/README @@ -0,0 +1,53 @@ +Some useful things to know about upstart on smgl + +- The jobs upstart knows about are in the *.conf files, + one file per service/daemon/task/job. Any file not ending in .conf + is ignored. + +- The jobs MAY NOT FAIL, or the entire boot process is halted... + Use a script in the scripts dir and a job pointing to it when + a job can fail and make sure the script exits cleanly. + +- tty{2,3} start as soon as everything is mounted. + Annoyingly, GDM (I'm not sure about the others) claims the 1st available + tty once it starts, so if tty{2,3} didn't start at that point, they'll + try to respawn forever, bothering GDM and ultimately bring down the CPU. + So when reordering the scripts, keep in mind that the displaymanager script + is started at least a second after tty{2,3}. tty1 is unaffected, as that's + started as soon as your / is mounted. + +- when writing a job, start on A and ( B or C ) won't work + use a separate BorC job and use start on A an BorC in the original job. + +feel free to post bugs with additional jobs on +http://bugs.sourcemage.org and assign them to abouter@sourcemage.org +I'll get to them eventually, or just put them in the smgl-upstart spell +yourself if you have git access ;) + +A little info on how to use upstart, because there isn't that much available +unless you run it in sysvcompat mode... + +starting and stopping jobs in upstart: + + start <jobname> + +or + + stop <jobname> + +where <jobname> is the jobs name in /etc/init without the .conf part. + +for example, to start lighty: + + start lighttpd + +for a list of jobs and their status: + + initctl list + +to emit a signal, in this case to stop everything that depends on network +connectivity but not the network job itself: + + initctl emit --no-wait network-stop + +the --no-wait means "don't wait around to see what is happening.. RUN!!" diff --git a/smgl/smgl-upstart/upstart-init/acpid.conf b/smgl/smgl-upstart/upstart-init/acpid.conf new file mode 100644 index 0000000000..2dc5d3b86f --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/acpid.conf @@ -0,0 +1,13 @@ +# acpid +# +# starts acpi daemon + +description "Enable acpi daemon" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on syslog-start +stop on shutdown + +expect fork + +exec /usr/sbin/acpid diff --git a/smgl/smgl-upstart/upstart-init/alsa-stop.conf b/smgl/smgl-upstart/upstart-init/alsa-stop.conf new file mode 100644 index 0000000000..a0fb188f0f --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/alsa-stop.conf @@ -0,0 +1,19 @@ +# alsa +# +# stores alsa settings + +description "Store alsa settings" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on shutdown + +task + +script + [ -e /etc/sysconfig/alsa ] && . /etc/sysconfig/alsa + declare -r ASOUNDCFG=/etc/asound.state + [[ "$START_ALSA" == no ]] && return 0 + if [[ -d /proc/asound ]]; then + /usr/sbin/alsactl -f $ASOUNDCFG store + fi || echo "init: alsa failed to stop" +end script diff --git a/smgl/smgl-upstart/upstart-init/alsa.conf b/smgl/smgl-upstart/upstart-init/alsa.conf new file mode 100644 index 0000000000..6bd9dd0cd8 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/alsa.conf @@ -0,0 +1,23 @@ +# alsa +# +# restores alsa settings + +description "Restore alsa settings" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-localfs + +task + +script + [ -e /etc/sysconfig/alsa ] && . /etc/sysconfig/alsa + declare -r ASOUNDCFG=/etc/asound.state + [[ "$START_ALSA" == no ]] && return 0 + if [[ -d /proc/asound ]]; then + if ! [[ -r "$ASOUNDCFG" ]]; then + echo "No mixer config in $ASOUNDCFG, you have to unmute your card!" + else + /usr/sbin/alsactl -f $ASOUNDCFG restore + fi + fi || echo "init: alsa failed to start" +end script diff --git a/smgl/smgl-upstart/upstart-init/avahi.conf b/smgl/smgl-upstart/upstart-init/avahi.conf new file mode 100644 index 0000000000..5f692705ee --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/avahi.conf @@ -0,0 +1,17 @@ +# avahi +# +# starts avahi-daemon + +description "Enable avahi-daemon" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on syslog-start and network-start and started dbus +stop on shutdown or network-stop or stopping dbus + +expect daemon + +exec /usr/sbin/avahi-daemon -D + +post-stop script + [ -e /var/run/avahi-daemon/socket] && rm -f /var/run/avahi-daemon/* +end script diff --git a/smgl/smgl-upstart/upstart-init/avahi.override b/smgl/smgl-upstart/upstart-init/avahi.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/avahi.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/native/clamav b/smgl/smgl-upstart/upstart-init/clamav.conf index b3d72deb2a..e92d5ecd55 100644 --- a/smgl/smgl-upstart/upstart-init/native/clamav +++ b/smgl/smgl-upstart/upstart-init/clamav.conf @@ -5,9 +5,9 @@ description "Start ClamAV" author "Arjan Bouter <abouter@sourcemage.org>" -emits clamav-started clamav-stopped - -start on network-start and syslog-start +start on mounted-remotefs and syslog-start stop on shutdown +expect fork + exec /usr/sbin/clamd diff --git a/smgl/smgl-upstart/upstart-init/native/control-alt-delete.conf b/smgl/smgl-upstart/upstart-init/control-alt-delete.conf index 590528dc05..e338bb6813 100644 --- a/smgl/smgl-upstart/upstart-init/native/control-alt-delete.conf +++ b/smgl/smgl-upstart/upstart-init/control-alt-delete.conf @@ -9,4 +9,6 @@ author "Scott James Remnant <scott@netsplit.com>" start on control-alt-delete task -exec shutdown -r now "Control-Alt-Delete pressed" +script + initctl emit --no-wait shutdown +end script diff --git a/smgl/smgl-upstart/upstart-init/dbus.conf b/smgl/smgl-upstart/upstart-init/dbus.conf new file mode 100644 index 0000000000..0f269dac2b --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/dbus.conf @@ -0,0 +1,20 @@ +# dbus +# +# starts dbus + +description "Start a dbus daemon" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on started devices +stop on shutdown + +pre-start script + [ -e /var/run/dbus/pid ] && rm -rf /var/run/dbus + [ -d /var/run/dbus ] || mkdir -p /var/run/dbus +end script + +expect fork + +exec dbus-daemon --system --fork + +post-start exec dbus-uuidgen --ensure diff --git a/smgl/smgl-upstart/upstart-init/devices.conf b/smgl/smgl-upstart/upstart-init/devices.conf new file mode 100644 index 0000000000..85ff7e057e --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/devices.conf @@ -0,0 +1,22 @@ +# devices +# +# set up devices in /dev when needed + +description "Sets hostname" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-rootfs + +task + +pre-start script + echo "devices pre-start" + . /etc/sysconfig/devices + if [ $DEVICES=udev ]; then + start udev + fi +end script + +script + echo "devices started" +end script diff --git a/smgl/smgl-upstart/upstart-init/displaymanager.conf b/smgl/smgl-upstart/upstart-init/displaymanager.conf new file mode 100644 index 0000000000..4b8724385a --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/displaymanager.conf @@ -0,0 +1,14 @@ +# displaymanager +# +# starts a login manager + +description "Starts a display manager (XDM,GDM,KDM,Entrance...)" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on started hald and syslog-start and started tty1 +stop on shutdown or stopping hald + +script + . /etc/sysconfig/facilities + exec $display_manager +end script diff --git a/smgl/smgl-upstart/upstart-init/native/freshclam b/smgl/smgl-upstart/upstart-init/freshclam.conf index ed678c410e..ea2cdaba2c 100644 --- a/smgl/smgl-upstart/upstart-init/native/freshclam +++ b/smgl/smgl-upstart/upstart-init/freshclam.conf @@ -5,7 +5,9 @@ description "Start Freshclam, the Clamav updater" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-start and syslog-start -stop on shutdown +start on mounted-remotefs and syslog-start +stop on shutdown or network-stop + +expect fork exec /usr/bin/freshclam -d diff --git a/smgl/smgl-upstart/upstart-init/hald.conf b/smgl/smgl-upstart/upstart-init/hald.conf new file mode 100644 index 0000000000..f97aa0abc4 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/hald.conf @@ -0,0 +1,14 @@ +# hald +# +# starts a hald daemon + +description "Start a hald demon" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs and syslog-start +stop on shutdown or stopping dbus + +expect fork +respawn + +exec /usr/sbin/hald --use-syslog diff --git a/smgl/smgl-upstart/upstart-init/native/hostname.conf b/smgl/smgl-upstart/upstart-init/hostname.conf index 9ac58bc396..0aaf3c4178 100644 --- a/smgl/smgl-upstart/upstart-init/native/hostname.conf +++ b/smgl/smgl-upstart/upstart-init/hostname.conf @@ -5,8 +5,7 @@ description "Sets hostname" author "Arjan Bouter <abouter@sourcemage.org>" -start on devices-start -stop on shutdown +start on started devices task diff --git a/smgl/smgl-upstart/upstart-init/ifupdown.conf b/smgl/smgl-upstart/upstart-init/ifupdown.conf new file mode 100644 index 0000000000..04d14f5c15 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/ifupdown.conf @@ -0,0 +1,26 @@ +# network +# +# starts networking + +description "Start networking" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on started devices + +task + +pre-start script + ifdown -a +end script + +script + echo "bringing up network interfaces" + ifconfig lo 127.0.0.1 + ifup -a +end script + +# only enable this if your NETWORK_INIT doesn't +# have a way to run a script once the connection +# is actually up, like /etc/network/scripts for +# ifupdown or /etc/wicd/scripts for wicd +#post-start exec initctl emit --no-wait network-start diff --git a/smgl/smgl-upstart/upstart-init/native/libvirtd.conf b/smgl/smgl-upstart/upstart-init/libvirtd.conf index 06aa4c161a..fd7d6a4c31 100644 --- a/smgl/smgl-upstart/upstart-init/native/libvirtd.conf +++ b/smgl/smgl-upstart/upstart-init/libvirtd.conf @@ -6,10 +6,13 @@ description "Start libvirtd" author "Arjan Bouter <abouter@sourcemage.org>" start on started xend -stop on stopped xend +stop on stopping xend + +expect fork pre-start script - [[ ! -d /var/run/libvirt ]] && mkdir -p /var/run/libvirt + [ ! -d /var/run/libvirt ] && mkdir -p /var/run/libvirt end script -exec /usr/sbin/libvirtd + +exec libvirtd diff --git a/smgl/smgl-upstart/upstart-init/lighttpd.conf b/smgl/smgl-upstart/upstart-init/lighttpd.conf new file mode 100644 index 0000000000..b938e6d6ec --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/lighttpd.conf @@ -0,0 +1,13 @@ +# lighttpd +# +# starts lighttpd + +description "Start lighttpd" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs +stop on shutdown or network-stop + +expect daemon + +exec /usr/sbin/lighttpd -f /etc/lighttpd.conf diff --git a/smgl/smgl-upstart/upstart-init/lighttpd.override b/smgl/smgl-upstart/upstart-init/lighttpd.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/lighttpd.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/mariadb.conf b/smgl/smgl-upstart/upstart-init/mariadb.conf new file mode 100644 index 0000000000..63abcf51f4 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mariadb.conf @@ -0,0 +1,41 @@ +# mariadb +# +# starts mariadb + +description "Start mariadb" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs + +pre-start script + . /etc/sysconfig/mariadb + [[ -d "$DATA_DIR" ]] || mkdir -p "$DATA_DIR" +end script + +script + . /etc/sysconfig/mariadb + # set some defaults for mariadb.server + datadir="${DATA_DIR}" + if [[ -z "$basedir" ]]; then + basedir=/usr + bindir=/usr/bin + else + bindir="${basedir}/bin" + fi + export PATH="/sbin:/usr/sbin:/bin:/usr/bin:$bindir" + if [[ -z pid_file ]]; then + pid_file="${datadir}/$(hostname).pid" + else + case "$pid_file" in + /* ) ;; + * ) pid_file="${datadir}/${pid_file}" ;; + esac + fi + exec $bindir/mysqld_safe --datadir="${datadir}" +end script + +pre-stop script + . /etc/sysconfig/mariadb + HOSTNAME=$(hostname) + kill $(cat "${DATADIR}/${HOSTNAME}.pid") +end script diff --git a/smgl/smgl-upstart/upstart-init/mariadb.override b/smgl/smgl-upstart/upstart-init/mariadb.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mariadb.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/mcelog.conf b/smgl/smgl-upstart/upstart-init/mcelog.conf new file mode 100644 index 0000000000..a91f845e3f --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mcelog.conf @@ -0,0 +1,13 @@ +# mcelog +# +# starts mcelog + +description "Start mcelog" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on syslog-start +stop on syslog-stop or shutdown + +expect daemon + +exec /usr/sbin/mcelog --daemon --pidfile /var/run/mcelog.pid diff --git a/smgl/smgl-upstart/upstart-init/metalog.conf b/smgl/smgl-upstart/upstart-init/metalog.conf new file mode 100644 index 0000000000..b557706cfc --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/metalog.conf @@ -0,0 +1,19 @@ +# metalog +# +# starts a metalog daemon + +description "Start a metalog daemon" +author "Arjan Bouter <abouter@sourcemage.org>" + +emits syslog-start + +start on started devices +stop on shutdown + +expect daemon + +exec metalog --daemonize --sync + +post-start script + initctl emit --no-wait syslog-start +end script diff --git a/smgl/smgl-upstart/upstart-init/mount_local.conf b/smgl/smgl-upstart/upstart-init/mount_local.conf new file mode 100644 index 0000000000..a15d9e32a1 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mount_local.conf @@ -0,0 +1,14 @@ +# mount_local +# +# mount local filesystems +# based on the init.d init scripts + +description "Mounts local filesystems" +author "Arjan Bouter <abouter@sourcemage.org>" + +emits mounted-localfs +start on started devices + +task + +exec /etc/init/scripts/mount_local.sh diff --git a/smgl/smgl-upstart/upstart-init/mount_remote.conf b/smgl/smgl-upstart/upstart-init/mount_remote.conf new file mode 100644 index 0000000000..8b2e9f74b9 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mount_remote.conf @@ -0,0 +1,17 @@ +# mount_remote +# +# mount remote filesystems + +description "Mounts remote filesystems" +author "Arjan Bouter <abouter@sourcemage.org>" + +emits mounted-remotefs +start on mounted-localfs and network-start + +task + +script + echo whut + mount -a -t "cifs,ncpfs,nfs,smbfs,9p" + initctl emit --no-wait mounted-remotefs +end script diff --git a/smgl/smgl-upstart/upstart-init/mount_root.conf b/smgl/smgl-upstart/upstart-init/mount_root.conf new file mode 100644 index 0000000000..65c726e46e --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mount_root.conf @@ -0,0 +1,15 @@ +# mount_root +# +# mount root filesystem and pseudo filesystems +# based on the init.d init scripts + +description "Mounts rootfs and various pseudo filesystems" +author "Arjan Bouter <abouter@sourcemage.org>" + +emits mounted-rootfs + +start on startup + +task + +exec /etc/init/scripts/mount_root.sh diff --git a/smgl/smgl-upstart/upstart-init/mpd.conf b/smgl/smgl-upstart/upstart-init/mpd.conf new file mode 100644 index 0000000000..fdba4e3ffb --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/mpd.conf @@ -0,0 +1,13 @@ +# mpd +# +# starts mpd + +description "Start Music Player Daemon" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs and syslog-start +stop on shutdown or network-stop + +expect fork + +exec /usr/bin/mpd /etc/mpd.conf diff --git a/smgl/smgl-upstart/upstart-init/native/README b/smgl/smgl-upstart/upstart-init/native/README deleted file mode 100644 index 19bbea9076..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/README +++ /dev/null @@ -1,28 +0,0 @@ -Some useful things to know about upstart on smgl - -- The jobs upstart knows about are in the *.conf files, one file per service/daemon/task/job, add or remove the .conf - part to en-/disable the job -- The jobs MAY NOT FAIL, or the entire boot process is halted... -- use a script in the scripts dir and a job pointing to it when a job can fail and make sure the script exits cleanly -- if a job needs to emit a signal, name it <jobname>-start or <jobname>-stop for consistency - -feel free to post bugs with additional jobs on http://bugs.sourcemage.org and assign them to abouter@sourcemage.org -I'll get to them eventually, or just put them in the spell yourself if you have git access ;) - -starting and stopping jobs in upstart: - - start <jobname> - -or - - stop <jobname> - -where <jobname> is the jobs name in /etc/init without the .conf part. - -for example, to start lighty: - - start lighttpd - -a list of jobs and there status: - - initctl list diff --git a/smgl/smgl-upstart/upstart-init/native/alsa.conf b/smgl/smgl-upstart/upstart-init/native/alsa.conf deleted file mode 100644 index def66bf9cb..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/alsa.conf +++ /dev/null @@ -1,27 +0,0 @@ -# alsa -# -# restores alsa settings - -description "Restore alsa settings" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on mount_all-start -stop on shutdown - -emits alsa-start alsa-stop - -task - -script - [ -e /etc/sysconfig/alsa ] && . /etc/sysconfig/alsa - declare -r ASOUNDCFG=/etc/asound.state - [[ "$START_ALSA" == no ]] && return 0 - if [[ -d /proc/asound ]]; then - if ! [[ -r "$ASOUNDCFG" ]]; then - echo "No mixer config in $ASOUNDCFG, you have to unmute your card!" - else - /usr/sbin/alsactl -f $ASOUNDCFG restore - fi - fi - initctl emit alsa-start -end script diff --git a/smgl/smgl-upstart/upstart-init/native/avahi.conf b/smgl/smgl-upstart/upstart-init/native/avahi.conf deleted file mode 100644 index 2fc2c17840..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/avahi.conf +++ /dev/null @@ -1,11 +0,0 @@ -# avahi -# -# starts avahi-daemon - -description "Enable avahi-daemon" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on syslog-start and network-start -stop on shutdown - -exec /usr/sbin/avahi-daemon -s diff --git a/smgl/smgl-upstart/upstart-init/native/dbus.conf b/smgl/smgl-upstart/upstart-init/native/dbus.conf deleted file mode 100644 index 4f4d899155..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/dbus.conf +++ /dev/null @@ -1,22 +0,0 @@ -# dbus -# -# scans starts dbus - -description "Start a dbus daemon" -author "Arjan Bouter <abouter@sourcemage.org>" - -emits dbus-start dbus-stop - -start on mount_all-start -stop on shutdown - -pre-start script - mkdir -p /var/run/dbus -end script - -script - [ -e /var/run/dbus/pid ] && rm -rf /var/run/dbus/* - dbus-daemon --system - dbus-uuidgen --ensure - initctl emit dbus-start -end script diff --git a/smgl/smgl-upstart/upstart-init/native/devices.conf b/smgl/smgl-upstart/upstart-init/native/devices.conf deleted file mode 100644 index 427adcc0ae..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/devices.conf +++ /dev/null @@ -1,37 +0,0 @@ -# devices -# -# populates /dev with devices and does some housekeeping when using udev, -# does nothing at all when using static /dev - -description "Populates /dev" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on mount_root-start -stop on shutdown - -emits devices-start - -task - -script - [ -e /etc/sysconfig/devices ] && . /etc/sysconfig/devices - case $DEVICES in - udev) echo "using udev to manage /dev" - mount -t tmpfs dev /dev - ln -s /proc/self/fd /dev/fd - ln -s /dev/fd/0 /dev/stdin - ln -s /dev/fd/1 /dev/stdout - ln -s /dev/fd/2 /dev/stderr - mkdir -p /dev/shm - mount -t tmpfs shm /dev/shm - mkdir -p /dev/pts - mount -t devpts devpts /dev/pts - udevd --daemon - udevadm trigger - udevadm settle --quiet - echo "done starting udev" ;; - static) echo "static /dev nothing to do" ;; - *) echo "unsupported /dev system, aborting" ;; - esac - initctl emit devices-start -end script diff --git a/smgl/smgl-upstart/upstart-init/native/gdm.conf b/smgl/smgl-upstart/upstart-init/native/gdm.conf deleted file mode 100644 index abb7d40013..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/gdm.conf +++ /dev/null @@ -1,11 +0,0 @@ -# gdm -# -# starts the GDM login manager - -description "Start GDM" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on hald-start -stop on shutdown - -exec /usr/sbin/gdm diff --git a/smgl/smgl-upstart/upstart-init/native/hald.conf b/smgl/smgl-upstart/upstart-init/native/hald.conf deleted file mode 100644 index 1376314b3b..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/hald.conf +++ /dev/null @@ -1,16 +0,0 @@ -# hald -# -# starts a hald daemon - -description "Start a hald demon" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on network-start -stop on shutdown - -emits hald-start hald-stop - -script - /usr/sbin/hald - initctl emit hald-start -end script diff --git a/smgl/smgl-upstart/upstart-init/native/lighttpd.conf b/smgl/smgl-upstart/upstart-init/native/lighttpd.conf deleted file mode 100644 index 455bc5401d..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/lighttpd.conf +++ /dev/null @@ -1,11 +0,0 @@ -# lighttpd -# -# starts lighttpd - -description "Start lighttpd" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on network-start and syslog-start -stop on shutdown - -exec /usr/sbin/lighttpd -D -f /etc/lighttpd.conf diff --git a/smgl/smgl-upstart/upstart-init/native/mpd.conf b/smgl/smgl-upstart/upstart-init/native/mpd.conf deleted file mode 100644 index 0d91216e7c..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/mpd.conf +++ /dev/null @@ -1,16 +0,0 @@ -# mpd -# -# starts mpd - -description "Start Music Player Daemon" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on network-start and alsa-start and syslog-start -stop on shutdown - -script - MPD_DB="$(grep db_file /etc/sysconfig/mpd | cut -d \" -f 2)" - ARGS="--no-daemon /etc/sysconfig/mpd" - [[ -z $MPD_DB ]] && ARGS="--create-db $ARGS" - /usr/bin/mpd $ARGS -end script diff --git a/smgl/smgl-upstart/upstart-init/native/network.conf b/smgl/smgl-upstart/upstart-init/native/network.conf deleted file mode 100644 index 1c7fc42f91..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/network.conf +++ /dev/null @@ -1,26 +0,0 @@ -# network -# -# starts networking - -description "Start networking" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on dbus-start -stop on shutdown - -emits network-start - -console output - -script - ifconfig lo 127.0.0.1 - . /etc/sysconfig/facilities - case $network in - wicd) echo "using wicd to manage your network" - /usr/sbin/wicd ;; - network) echo "using ifup -a to bring up networking" - ifup -a ;; - *) echo "unknown network provider, aborting" ;; - esac - initctl emit network-start -end script diff --git a/smgl/smgl-upstart/upstart-init/native/syslog.conf b/smgl/smgl-upstart/upstart-init/native/syslog.conf deleted file mode 100644 index 21c67e0a3d..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/syslog.conf +++ /dev/null @@ -1,21 +0,0 @@ -# syslog -# -# starts a syslog daemon - -description "Start a syslog daemon" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on filesystems-mounted -stop on shutdown - -emits syslog-start syslog-stop - -script - . /etc/sysconfig/facilities - case $syslog in - smgl-metalog) echo "Starting metalog" - initctl emit syslog-start & - metalog ;; - *) echo "unknown syslog provider, aborting" ;; - esac -end script diff --git a/smgl/smgl-upstart/upstart-init/native/xinetd.conf b/smgl/smgl-upstart/upstart-init/native/xinetd.conf deleted file mode 100644 index 0245ddc765..0000000000 --- a/smgl/smgl-upstart/upstart-init/native/xinetd.conf +++ /dev/null @@ -1,11 +0,0 @@ -# xinetd -# -# starts xinetd - -description "Start xinetd" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on network-up and syslog-start -stop on shutdown - -exec /usr/sbin/xinetd -dontfork diff --git a/smgl/smgl-upstart/upstart-init/postgresql.conf b/smgl/smgl-upstart/upstart-init/postgresql.conf new file mode 100644 index 0000000000..0aa890e21b --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/postgresql.conf @@ -0,0 +1,29 @@ +# postgresql +# +# starts postgresql + +description "Start PostrgeSQL" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs +stop on shutdown or network-stop + +expect daemon + +script + . /etc/sysconfig/postgresql + cd "$DBPATH" && + if [[ ! -z $PORT ]]; then + PGPORT="-o -p $PORT" + fi && + if [[ ! -z $LOGFILE ]]; then + PGLOG="-l $LOGFILE" + fi && + su $USER -s /bin/sh -c "pg_ctl start -D $DBPATH -s $PGLOG $PGPORT" +end script + +pre-stop script + . /etc/sysconfig/postgresql + cd "$DBPATH" && + su $USER -s /bin/sh -c "pg_ctl stop -D $DBPATH -m fast" +end script diff --git a/smgl/smgl-upstart/upstart-init/postgresql.override b/smgl/smgl-upstart/upstart-init/postgresql.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/postgresql.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/native/mount_all.conf b/smgl/smgl-upstart/upstart-init/scripts/mount_local.sh index 2776c69cae..d0e97c0e41 100644..100755 --- a/smgl/smgl-upstart/upstart-init/native/mount_all.conf +++ b/smgl/smgl-upstart/upstart-init/scripts/mount_local.sh @@ -1,37 +1,12 @@ +#!/bin/bash # mount_all # # mount local filesystems # based on the init.d init scripts -description "Mounts local filesystems" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on devices-start -stop on shutdown - -emits mount_all-start - -task -console output - -script - [ -e /etc/sysconfig/init ] && . /etc/sysconfig/init [ -e /etc/sysconfig/mountall ] && . /etc/sysconfig/mountall - # find devices that were set up in initramfs/rd - if [ -x /sbin/dmsetup ]; then - echo "(re)Creating device mapper nodes..." - # won't check retval because kernel just may lack device mapper - dmsetup mknodes || echo "failed (re)creating nodes" - fi - - if [ -x /sbin/vgscan ] && [ -x /sbin/vgchange ]; then - echo "Scanning for and initializing all available LVM volume groups..." - /sbin/vgscan --ignorelockingfailure --mknodes - /sbin/vgchange -ay --ignorelockingfailure - fi - # if [ -x /usr/sbin/cryptsetup ] && [ -f /etc/crypttab ]; then # echo "Attempting to open luks encrypted partitions" # grep -v '^#' /etc/crypttab | @@ -56,7 +31,7 @@ script # done # fi - [ -e /fastboot ] && return +# [ -e /fastboot ] && return [ -e /forcefsck ] && FORCE="-f" [ "$NOSOFTFIX" != yes ] && FIX="-a" [ "$FSCKFIX" = yes ] && FIX="-y" @@ -72,9 +47,10 @@ script echo "manually by running /sbin/fsck" echo "without the -a option" $NORMAL - /sbin/sulogin - /sbin/reboot -f - fi + # /sbin/sulogin + # /sbin/reboot -f + echo "$WARNING WTF! repair your fs! $NORMAL" + fi [ -e /fastboot ] && rm -f /fastboot [ -e /forcefsck ] && rm -f /forcefsck @@ -91,10 +67,10 @@ script # mount tmpfs mounts after physical partitions they might mount to (bug 3597) mount -a -t tmpfs - # bug 7311 - if proc was mounted, list it in mtab; awk is /usr friendly - if awk 'BEGIN{proc=1} /\/proc/{proc=0} END{exit proc}' /proc/mounts; then - builtin echo 'none /proc proc rw 0 0' >> /etc/mtab - fi +# # bug 7311 - if proc was mounted, list it in mtab; awk is /usr friendly +# if awk 'BEGIN{proc=1} /\/proc/{proc=0} END{exit proc}' /proc/mounts; then +# builtin echo 'none /proc proc rw 0 0' >> /etc/mtab +# fi #As per FHS sm bug #10509 #FIXME: doing this here kills upstart... fix this bug again later... @@ -112,8 +88,8 @@ script echo "Writing dmesg log to /var/log/dmesg..." [ -d /var/log ] && dmesg > /var/log/dmesg -# echo "Making /tmp/.ICE-unix temporary directory..." -# [ -d /tmp ] && mkdir -p /tmp/.ICE-unix && chmod 1777 /tmp/.ICE-unix + echo "Making /tmp/.ICE-unix temporary directory..." + [ -d /tmp ] && mkdir -p /tmp/.ICE-unix && chmod 1777 /tmp/.ICE-unix - initctl emit mount_all-start -end script + initctl emit --no-wait mounted-localfs + echo "done mounting other filesystems" diff --git a/smgl/smgl-upstart/upstart-init/native/mount_root.conf b/smgl/smgl-upstart/upstart-init/scripts/mount_root.sh index eb50886df9..8d0c9dd513 100644..100755 --- a/smgl/smgl-upstart/upstart-init/native/mount_root.conf +++ b/smgl/smgl-upstart/upstart-init/scripts/mount_root.sh @@ -1,38 +1,32 @@ +#!/bin/bash # mount_root # # mount root filesystem and pseudo filesystems # based on the init.d init scripts -description "Mounts rootfs and various pseudo filesystems" -author "Arjan Bouter <abouter@sourcemage.org>" - -start on startup -stop on shutdown - -emits mount_root-start mount_rootfs-stop - -task -console output - -script [ -e /etc/sysconfig/init ] && . /etc/sysconfig/init # proc and sys are needed for scanlvm mount -t proc proc /proc mount -t sysfs sysfs /sys + echo "Mounting root file system read write..." + mount -n -o remount,rw / + # find devices that were set up in initramfs/rd if [ -x /sbin/dmsetup ]; then echo "(re)Creating device mapper nodes..." - # won't check retval because kernel just may lack device mapper - /sbin/dmsetup mknodes + # Make sure dmsetup doesn't halt mount_root because kernel just may + # lack device mapper + dmsetup mknodes + echo "Done messing with device nodes" else - echo "Not running dmsetup" + echo "Not running dmsetup" fi if [ -x /sbin/vgscan ] && [ -x /sbin/vgchange ]; then echo "Scanning for and initializing all available LVM volume groups..." - /sbin/vgscan --ignorelockingfailure --mknodes && + /sbin/vgscan --ignorelockingfailure --mknodes /sbin/vgchange -ay --ignorelockingfailure else echo "Not starting LVM" @@ -81,8 +75,14 @@ script mount -f -o remount,rw / mount -t tmpfs lock /var/lock - mount -t tmpfs run /var/run +# upstart uses /var/run, do not mount a tmpfs over it +# mount -t tmpfs run /var/run mount -t tmpfs tmp /tmp - echo "done mounting rootfs" - initctl emit mount_root-start -end script + +# [[ -x /sbin/selinuxenabled ]] && if selinuxenabled ; then +# [[ -d /selinux ]] || mkdir -p /selinux +# mount -t selinuxfs selinux /selinux +# fi + + initctl emit --no-wait mounted-rootfs || echo "failed preparing your rootfs" + echo "done processing mout_root" diff --git a/smgl/smgl-upstart/upstart-init/native/shorewall.conf b/smgl/smgl-upstart/upstart-init/shorewall.conf index f87a9ae599..4d45afdf36 100644 --- a/smgl/smgl-upstart/upstart-init/native/shorewall.conf +++ b/smgl/smgl-upstart/upstart-init/shorewall.conf @@ -5,30 +5,31 @@ description "Start shorewall" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-up -stop on shutdown +start on network-start task -console output -script +pre-start script . /etc/sysconfig/shorewall + # Shorewall needs /var/lock/subsys + if [[ ! -d /var/lock/subsys/ ]] + then + mkdir -p /var/lock/subsys/ + fi + # Shorewall needs /var/log/messages to exist if [[ ! -f /var/log/messages ]] then touch /var/log/messages - fi && - # Create shorewall log file if it doesn't exist - if [[ ! -f $SHOREWALL_LOG ]] - then - touch $SHOREWALL_LOG - fi && - # Shorewall needs subsys - if [[ ! -d /var/lock/subsys/ ]] - then - mkdir -p /var/lock/subsys/ - fi && - date "$DATE_FORMAT" >> $SHOREWALL_LOG 2>&1 - shorewall start >> $SHOREWALL_LOG 2>&1 + fi +end script + +script + SHOREWALL_STATUS="$(awk '{print $1}' /var/lib/shorewall/state)" + if [[ "$SHOREWALL_STATUS" = "Stopped" ]]; then + shorewall start + else + shorewall restart + fi end script diff --git a/smgl/smgl-upstart/upstart-init/shorewall6.conf b/smgl/smgl-upstart/upstart-init/shorewall6.conf new file mode 100644 index 0000000000..8a6522b450 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/shorewall6.conf @@ -0,0 +1,35 @@ +# shorewall6 +# +# starts shorewall6 + +description "Start shorewall6" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on network-start + +task + +pre-start script + . /etc/sysconfig/shorewall + + # Shorewall needs /var/lock/subsys + if [[ ! -d /var/lock/subsys/ ]] + then + mkdir -p /var/lock/subsys/ + fi + + # Shorewall needs /var/log/messages to exist + if [[ ! -f /var/log/messages ]] + then + touch /var/log/messages + fi +end script + +script + SHOREWALL_STATUS="$(awk '{print $1}' /var/lib/shorewall6/state)" + if [[ "$SHOREWALL_STATUS" = "Stopped" ]]; then + shorewall6 start + else + shorewall6 restart + fi +end script diff --git a/smgl/smgl-upstart/upstart-init/native/shutdown.conf b/smgl/smgl-upstart/upstart-init/shutdown.conf index 57603c8476..27c9d14b63 100644 --- a/smgl/smgl-upstart/upstart-init/native/shutdown.conf +++ b/smgl/smgl-upstart/upstart-init/shutdown.conf @@ -6,23 +6,28 @@ description "Shutdown" author "Arjan Bouter <abouter@sourcemage.org>" start on shutdown -#stop on startup task console output script + echo "signalling everything to stop" + initctl emit shutdown && sleep 5 for running_job in $(initctl list|grep running|awk -F' ' '{print $1}'); do if [[ "$running_job" = 'tty1' ]]; then echo "leave tty1 running, just in case..." + elif [[ "$running_job" = 'shutdown' ]]; then + echo "leave shutdown running, obviously" + elif [[ "$running_job" = 'init' ]]; then + echo "leave init running, obviously" else + echo "Stopping job $running_job" stop $running_job fi done - echo "signalling everything else to stop" - initctl emit shutdown echo "unmounting filesystems" - umount -a + umount -a -t notmpfs + killall udevd sync echo "powering off" poweroff -f diff --git a/smgl/smgl-upstart/upstart-init/native/slapd.conf b/smgl/smgl-upstart/upstart-init/slapd.conf index 5f7ca91490..f8f6aa7161 100644 --- a/smgl/smgl-upstart/upstart-init/native/slapd.conf +++ b/smgl/smgl-upstart/upstart-init/slapd.conf @@ -5,10 +5,12 @@ description "Start OpenLDAP slapd" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-up and syslog-start -stop on shutdown +start on mounted-remotefs +stop on shutdown or network-stop + +expect daemon script . /etc/sysconfig/slapd - slapd -d -h $SLAPD_URL + slapd -h $SLAPD_URL end script diff --git a/smgl/smgl-upstart/upstart-init/slapd.override b/smgl/smgl-upstart/upstart-init/slapd.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/slapd.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/snort.conf b/smgl/smgl-upstart/upstart-init/snort.conf new file mode 100644 index 0000000000..6fd0d0548f --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/snort.conf @@ -0,0 +1,13 @@ +# snort +# +# starts snort + +description "Start snort" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on started postgresql +stop on shutdown stopping postgresql + +expect fork + +exec snort -D -u snort -g snort -c /etc/snort/snort.conf -i wlan0 diff --git a/smgl/smgl-upstart/upstart-init/snort.override b/smgl/smgl-upstart/upstart-init/snort.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/snort.override @@ -0,0 +1 @@ +manual diff --git a/smgl/smgl-upstart/upstart-init/sshd.conf b/smgl/smgl-upstart/upstart-init/sshd.conf new file mode 100644 index 0000000000..df065e411b --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/sshd.conf @@ -0,0 +1,13 @@ +# sshd +# +# starts openssh's sshd + +description "Start sshd" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs and syslog-start +stop on shutdown or network-stop + +expect fork + +exec /usr/sbin/sshd diff --git a/smgl/smgl-upstart/upstart-init/native/sulogin.conf b/smgl/smgl-upstart/upstart-init/sulogin.conf index 03823a1c3c..dc958cced2 100644 --- a/smgl/smgl-upstart/upstart-init/native/sulogin.conf +++ b/smgl/smgl-upstart/upstart-init/sulogin.conf @@ -5,14 +5,15 @@ start on stalled -exec /sbin/sulogin console owner pre-start script - echo + echo "" echo "The system has reached a state where there are no jobs running." echo "A shell will be spawned so that you may start such jobs that are" echo "necessary." - echo + echo "" echo "Type 'exit' when finished." end script + +exec /sbin/sulogin diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/control-alt-delete b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/control-alt-delete deleted file mode 100644 index 35cb13051a..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/control-alt-delete +++ /dev/null @@ -1,8 +0,0 @@ -# control-alt-delete - emergency keypress handling -# -# This task is run whenever the Control-Alt-Delete key combination is -# pressed. Usually used to shut down the machine. - -start on control-alt-delete - -exec /sbin/shutdown -r now "Control-Alt-Delete pressed" diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc-default b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc-default deleted file mode 100644 index 191763d400..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc-default +++ /dev/null @@ -1,23 +0,0 @@ -# rc - runlevel compatibility -# -# This task guesses what the "default runlevel" should be and starts the -# appropriate script. - -start on stopped rcS - -script - runlevel --reboot || true - - if grep -q -w -- "-s\|single\|S" /proc/cmdline; then - telinit S - elif [ -r /etc/inittab ]; then - RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)" - if [ -n "$RL" ]; then - telinit $RL - else - telinit 2 - fi - else - telinit 2 - fi -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc0 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc0 deleted file mode 100644 index bbd56b34fc..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc0 +++ /dev/null @@ -1,25 +0,0 @@ -# rc0 - runlevel 0 compatibility -# -# This task runs the old sysv-rc runlevel 0 ("halt/poweroff") scripts with -# the decision as to whether to halt or power off the system left up to the -# script (and thus /etc/default/poweroff). - -start on runlevel 0 - -stop on runlevel - -console output -script - set $(runlevel || true) - if [ "$2" != "0" ] && [ "$2" != "6" ]; then - set $(runlevel --set 0 || true) - fi - - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 0 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc1 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc1 deleted file mode 100644 index edd3284118..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc1 +++ /dev/null @@ -1,19 +0,0 @@ -# rc1 - runlevel 1 compatibility -# -# This task runs the old sysv-rc runlevel 1 ("single-user") scripts. - -start on runlevel 1 - -stop on runlevel - -console output -script - set $(runlevel --set 1 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 1 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc2 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc2 deleted file mode 100644 index 0068fe9c55..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc2 +++ /dev/null @@ -1,20 +0,0 @@ -# rc2 - runlevel 2 compatibility -# -# This task runs the old sysv-rc runlevel 2 ("multi-user") scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 2 - -stop on runlevel - -console output -script - set $(runlevel --set 2 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 2 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc3 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc3 deleted file mode 100644 index 7b71b3e4d7..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc3 +++ /dev/null @@ -1,20 +0,0 @@ -# rc3 - runlevel 3 compatibility -# -# This task runs the old sysv-rc runlevel 3 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 3 - -stop on runlevel - -console output -script - set $(runlevel --set 3 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 3 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc4 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc4 deleted file mode 100644 index 6fbe51f237..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc4 +++ /dev/null @@ -1,20 +0,0 @@ -# rc4 - runlevel 4 compatibility -# -# This task runs the old sysv-rc runlevel 4 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 4 - -stop on runlevel - -console output -script - set $(runlevel --set 4 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 4 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc5 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc5 deleted file mode 100644 index 8af5080307..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc5 +++ /dev/null @@ -1,20 +0,0 @@ -# rc5 - runlevel 5 compatibility -# -# This task runs the old sysv-rc runlevel 5 (user defined) scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel 5 - -stop on runlevel - -console output -script - set $(runlevel --set 5 || true) - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 5 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc6 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc6 deleted file mode 100644 index c238837d62..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rc6 +++ /dev/null @@ -1,23 +0,0 @@ -# rc6 - runlevel 6 compatibility -# -# This task runs the old sysv-rc runlevel 6 ("reboot") scripts. - -start on runlevel 6 - -stop on runlevel - -console output -script - set $(runlevel || true) - if [ "$2" != "0" ] && [ "$2" != "6" ]; then - set $(runlevel --set 6 || true) - fi - - if [ "$1" != "unknown" ]; then - PREVLEVEL=$1 - RUNLEVEL=$2 - export PREVLEVEL RUNLEVEL - fi - - exec /etc/init/rc 6 -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS deleted file mode 100644 index 3eccece9ba..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS +++ /dev/null @@ -1,24 +0,0 @@ -# rcS - runlevel compatibility -# -# This task runs the old sysv-rc startup scripts. - -start on startup - -stop on runlevel - -# Note: there can be no previous runlevel here, if we have one it's bad -# information (we enter rc1 not rcS for maintenance). Run /etc/init/rc -# without information so that it defaults to previous=N runlevel=S. -console output -script - runlevel --set S >/dev/null || true - - #set $(runlevel --set S || true) - #if [ "$1" != "unknown" ]; then - # PREVLEVEL=$1 - # RUNLEVEL=$2 - # export PREVLEVEL RUNLEVEL - #fi - - exec /etc/init/rcS -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS-sulogin b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS-sulogin deleted file mode 100644 index 40fd13a85b..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/rcS-sulogin +++ /dev/null @@ -1,25 +0,0 @@ -# rcS-sulogin - "single-user" runlevel compatibility -# -# This task runs the sulogin binary during "single-user" mode. - -start on runlevel S - -stop on runlevel - -console owner - -script - runlevel --set S >/dev/null || true - /sbin/sulogin - - if [ -r /etc/inittab ]; then - RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)" - if [ -n "$RL" ]; then - telinit $RL - else - telinit 2 - fi - else - telinit 2 - fi -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/sulogin b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/sulogin deleted file mode 100644 index 931fb06247..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/sulogin +++ /dev/null @@ -1,18 +0,0 @@ -# sulogin - rescue mode -# -# This task ensures that should the system fail to have any active jobs -# that the system administrator can rescue it; by giving them a shell. - -#start on stalled - -exec /sbin/sulogin -console owner - -pre-start script - echo - echo "The system has reached a state where there are no jobs running." - echo "A shell will be spawned so that you may start such jobs that are" - echo "necessary." - echo - echo "Type 'exit' when finished." -end script diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty1 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty1 deleted file mode 100644 index 9f653b5cf9..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty1 +++ /dev/null @@ -1,16 +0,0 @@ -# tty1 - getty -# -# This service maintains a getty on tty1 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 -start on runlevel 4 -start on runlevel 5 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty1 diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty2 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty2 deleted file mode 100644 index 3f07f87dcb..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty2 +++ /dev/null @@ -1,16 +0,0 @@ -# tty2 - getty -# -# This service maintains a getty on tty2 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 4 -stop on runlevel 5 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty2 diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty3 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty3 deleted file mode 100644 index b489222d77..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty3 +++ /dev/null @@ -1,16 +0,0 @@ -# tty3 - getty -# -# This service maintains a getty on tty3 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 4 -stop on runlevel 5 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty3 diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty4 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty4 deleted file mode 100644 index ea1783cedf..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty4 +++ /dev/null @@ -1,16 +0,0 @@ -# tty4 - getty -# -# This service maintains a getty on tty4 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 4 -stop on runlevel 5 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty4 diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty5 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty5 deleted file mode 100644 index f2189088ea..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty5 +++ /dev/null @@ -1,16 +0,0 @@ -# tty5 - getty -# -# This service maintains a getty on tty5 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 4 -stop on runlevel 5 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty5 diff --git a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty6 b/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty6 deleted file mode 100644 index 1c5994e574..0000000000 --- a/smgl/smgl-upstart/upstart-init/sysvcompat/sysvcompat/tty6 +++ /dev/null @@ -1,16 +0,0 @@ -# tty6 - getty -# -# This service maintains a getty on tty6 from the point the system is -# started until it is shut down again. - -start on runlevel 2 -start on runlevel 3 - -stop on runlevel 0 -stop on runlevel 1 -stop on runlevel 4 -stop on runlevel 5 -stop on runlevel 6 - -respawn -exec /sbin/getty 38400 tty6 diff --git a/smgl/smgl-upstart/upstart-init/native/tty1.conf b/smgl/smgl-upstart/upstart-init/tty1.conf index 9bf1c8dead..3277b59c65 100644 --- a/smgl/smgl-upstart/upstart-init/native/tty1.conf +++ b/smgl/smgl-upstart/upstart-init/tty1.conf @@ -6,7 +6,7 @@ description "start agetty on tty1" author "Arjan Bouter <abouter@sourcemage.org>" -start on mount_root-start +start on started devices # let's keep a tty around for now ;) #stop on shutdown diff --git a/smgl/smgl-upstart/upstart-init/native/tty2.conf b/smgl/smgl-upstart/upstart-init/tty2.conf index 67d59716af..d62fcca402 100644 --- a/smgl/smgl-upstart/upstart-init/native/tty2.conf +++ b/smgl/smgl-upstart/upstart-init/tty2.conf @@ -6,7 +6,7 @@ description "start agetty on tty2" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-up +start on started devices stop on shutdown console owner diff --git a/smgl/smgl-upstart/upstart-init/native/tty3.conf b/smgl/smgl-upstart/upstart-init/tty3.conf index 7ec7eab3a1..a451862b1b 100644 --- a/smgl/smgl-upstart/upstart-init/native/tty3.conf +++ b/smgl/smgl-upstart/upstart-init/tty3.conf @@ -6,7 +6,7 @@ description "start agetty on tty3" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-up +start on started devices stop on shutdown console owner diff --git a/smgl/smgl-upstart/upstart-init/udev.conf b/smgl/smgl-upstart/upstart-init/udev.conf new file mode 100644 index 0000000000..817a68b2ca --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/udev.conf @@ -0,0 +1,33 @@ +# devices +# +# populates /dev with devices, does some housekeeping when using udev, +# does nothing at all when using static /dev and might do something in +# the future for other /dev systems ;) + +description "Populates /dev if needed" +author "Arjan Bouter <abouter@sourcemage.org>" + +# started by devices +manual + +task + +script + echo "mounting pseudo filesystems and creating links in /dev" + mount -t tmpfs dev /dev + ln -s /proc/self/fd /dev/fd + ln -s /dev/fd/0 /dev/stdin + ln -s /dev/fd/1 /dev/stdout + ln -s /dev/fd/2 /dev/stderr + mkdir -p /dev/shm + mount -t tmpfs shm /dev/shm + mkdir -p /dev/pts + mount -t devpts devpts /dev/pts + echo "starting udevd" + udevd --daemon + echo "triggering udev events" + udevadm trigger + udevadm settle --quiet + echo "creating device nodes" + [[ -e /dev/mapper/control ]] && dmsetup mknodes +end script diff --git a/smgl/smgl-upstart/upstart-init/watchdog.conf b/smgl/smgl-upstart/upstart-init/watchdog.conf new file mode 100644 index 0000000000..5930ee30a3 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/watchdog.conf @@ -0,0 +1,13 @@ +# watchdog +# +# starts watchdog + +description "Start Watchdog" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-localfs +stop on shutdown + +expect daemon + +exec /usr/sbin/watchdog diff --git a/smgl/smgl-upstart/upstart-init/native/xend.conf b/smgl/smgl-upstart/upstart-init/xend.conf index ace598ec69..0c821affd1 100644 --- a/smgl/smgl-upstart/upstart-init/native/xend.conf +++ b/smgl/smgl-upstart/upstart-init/xend.conf @@ -5,21 +5,19 @@ description "Check for Xen and run xend" author "Arjan Bouter <abouter@sourcemage.org>" -start on network-up and syslog-start +start on mounted-remotefs stop on shutdown +expect fork + pre-start script - if xen-detect > /dev/null 2>&1 ; then - echo 'Running in xen!' + if xen-detect -N > /dev/null 2>&1 ; then mount -t xenfs xenfs /proc/xen else - echo "Not running in Xen, won't start xend." return 1 fi end script exec xend start -#stop exec xend stop - -#status exec xend status +pre-stop exec xend stop diff --git a/smgl/smgl-upstart/upstart-init/xinetd.conf b/smgl/smgl-upstart/upstart-init/xinetd.conf new file mode 100644 index 0000000000..0f96c2db50 --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/xinetd.conf @@ -0,0 +1,13 @@ +# xinetd +# +# starts xinetd + +description "Start xinetd" +author "Arjan Bouter <abouter@sourcemage.org>" + +start on mounted-remotefs and syslog-start +stop on shutdown or network-stop + +expect fork + +exec /usr/sbin/xinetd diff --git a/smgl/smgl-upstart/upstart-init/xinetd.override b/smgl/smgl-upstart/upstart-init/xinetd.override new file mode 100644 index 0000000000..2905494b6d --- /dev/null +++ b/smgl/smgl-upstart/upstart-init/xinetd.override @@ -0,0 +1 @@ +manual |