diff -Nru sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog --- sysvinit-2.88dsf/debian/changelog 2016-06-15 08:44:21.000000000 +0000 +++ sysvinit-2.88dsf/debian/changelog 2016-06-23 07:04:39.000000000 +0000 @@ -1,3 +1,29 @@ +sysvinit (2.88dsf-59.7ubuntu1) yakkety; urgency=medium + + * Drop our massive delta on the initscripts package, and instead not build + it at all any more. All remaining reverse dependencies are gone now. + * Merge with Debian unstable. Remaining Ubuntu changes: + - debian/control: Drop Essential: yes from sysvinit-utils since we use + systemd (and previously upstart). + - Mark sysvinit-utils as Multi-Arch: foreign to allow for init + to be installable with multi-arch (needed for armhf containers on x86) + - debian/control: Do not build the sysvinit, sysvinit-core, bootlogd, and + initscripts binary packages. We don't want to support sysvinit as such. + - Add /usr/lib/insserv/ to sysv-rc.postinst's PATH so that it can find the + insserv binary, since it is moved by the current Ubuntu delta in the + insserv package (LP: #1507151). + + -- Martin Pitt Thu, 23 Jun 2016 08:54:58 +0200 + +sysvinit (2.88dsf-59.7) unstable; urgency=medium + + * Non-maintainer upload. + * Drop sysvinit-utils' versioned Breaks: on initscripts, as this causes apt + to fail upgrades because of Breaks/Depends loops on essential packages. + Only keep the Replaces: for moving vars.sh. (Closes: #827705) + + -- Martin Pitt Wed, 22 Jun 2016 12:33:26 +0200 + sysvinit (2.88dsf-59.6ubuntu1) yakkety; urgency=medium * Merge with Debian unstable. See 2.88dsf-59.4ubuntu1 for remaining Ubuntu @@ -9506,4 +9532,3 @@ /var/log and /etc itself. -- Miquel van Smoorenburg Tue, 29 Oct 1996 13:46:54 +0100 - diff -Nru sysvinit-2.88dsf/debian/control sysvinit-2.88dsf/debian/control --- sysvinit-2.88dsf/debian/control 2016-06-15 08:44:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/control 2016-06-23 06:54:35.000000000 +0000 @@ -22,7 +22,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, init-system-helpers (>= 1.25~) # sulogin, last, lastb and mesg was moved to the util-linux package , util-linux (>> 2.28-2~) -Breaks: upstart (<< 1.5-0ubuntu5), systemd (<< 215), initscripts (<< 2.88dsf-59.5) +Breaks: upstart (<< 1.5-0ubuntu5), systemd (<< 215) Suggests: bootlogd, sash Description: System-V-like utilities This package contains the important System-V-like utilities. @@ -45,61 +45,3 @@ This package provides support for the System-V like system for booting, changing runlevels, and shutting down, configured through symbolic links in /etc/rc?.d/. - -Package: initscripts -Architecture: any -Multi-Arch: foreign -Depends: - ${shlibs:Depends}, ${misc:Depends}, ${mount:Depends}, - debianutils (>= 4), - lsb-base (>= 3.2-14), - sysvinit-utils (>= 2.88dsf-59.5), sysv-rc | file-rc, - coreutils (>= 5.93), -Recommends: psmisc, e2fsprogs -Conflicts: - libdevmapper1.02.1 (<< 2:1.02.24-1), -Replaces: libc6, libc6.1, libc0.1, libc0.3 -Breaks: -# Needed for ifquery - ifupdown (<< 0.7.46), -# /bin/mountpoint was moved to util-linux - util-linux (<< 2.26.2-4~), -# Packages using /lib/init/rw which must transition to /run. -# These breaks may be removed after wheezy is released. - aide (<< 0.15.1-5), - atm-tools (<< 1:2.5.1-1.3), - console-common (<< 0.7.86), - console-setup (<< 1.74), - cruft (<< 0.9.16), - eepc-acpi-scripts (<< 1.1.12), - fcheck (<< 2.7.59-16), - hostapd (<< 1:0.7.3-3), - live-build (<< 3.0~a26-1), - ltsp-client-core (<< 5.2.16-1), - mdadm (<< 3.2.2-1), - nbd-client (<< 1:2.9.23-1), - nfs-common (<< 1:1.2.5-3), - portmap (<< 6.0.0-2), - readahead-fedora (<< 2:1.5.6-3), - resolvconf (<< 1.49), - rpcbind (<< 0.2.0-7), - rsyslog (<< 5.8.2-2), - splashy (<< 0.3.13-5.1+b1), - sysklogd (<< 1.5-6.2), - wpasupplicant (<< 0.7.3-4), - xymon (<< 4.3.0~beta2.dfsg-9), - selinux-policy-default (<= 2:0.2.20100524-9), -# Packages relying on a writable /etc/mtab which need fixing -# before they can work with /proc/mounts and utab with libmount. - libpam-mount (<< 2.13-1), - autofs (<< 5.0.0), -# Older versions of initramfs-tools can't cope with /etc/mtab -# being a symlink #668616 and #668650 - initramfs-tools (<< 0.104), -# Needed for transition to dependency-based boot for wheezy - bootchart (<< 0.10~svn407-4), -# Older versions of hurd do not implement the neccessary functionality - hurd (<< 0.5.git20131101~) -Description: scripts for initializing and shutting down the system - The scripts in this package initialize a standard Debian - system at boot time and shut it down at halt or reboot time. diff -Nru sysvinit-2.88dsf/debian/initscripts.conffiles sysvinit-2.88dsf/debian/initscripts.conffiles --- sysvinit-2.88dsf/debian/initscripts.conffiles 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/initscripts.conffiles 2016-06-03 09:31:02.000000000 +0000 @@ -1,3 +1,4 @@ +/etc/init.d/bootlogs /etc/init.d/bootmisc.sh /etc/init.d/checkfs.sh /etc/init.d/checkroot.sh @@ -5,15 +6,16 @@ /etc/init.d/halt /etc/init.d/hostname.sh /etc/init.d/killprocs +/etc/init.d/motd /etc/init.d/mountall.sh /etc/init.d/mountall-bootclean.sh /etc/init.d/mountnfs.sh /etc/init.d/mountnfs-bootclean.sh /etc/init.d/mountdevsubfs.sh /etc/init.d/mountkernfs.sh -/etc/init.d/ondemand /etc/init.d/rc.local /etc/init.d/reboot +/etc/init.d/rmnologin /etc/init.d/sendsigs /etc/init.d/single /etc/init.d/umountfs @@ -23,3 +25,5 @@ /etc/default/devpts /etc/default/halt /etc/default/rcS +/etc/default/tmpfs +/etc/network/if-up.d/mountnfs diff -Nru sysvinit-2.88dsf/debian/initscripts.postinst sysvinit-2.88dsf/debian/initscripts.postinst --- sysvinit-2.88dsf/debian/initscripts.postinst 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/initscripts.postinst 2016-06-03 09:31:02.000000000 +0000 @@ -6,6 +6,8 @@ set -e . /lib/init/vars.sh +. /lib/init/tmpfs.sh +. /lib/init/mount-functions.sh # Set this as a variable to hide from lintian the fact that we're removing # it; otherwise, a wrong lintian check + ftp fatal autoreject prevents us @@ -147,12 +149,18 @@ if [ -x /etc/init.d/single ]; then update-rc.d single defaults >/dev/null || exit $? fi -if [ -x /etc/init.d/ondemand ]; then -update-rc.d ondemand defaults >/dev/null || exit $? +if [ -x /etc/init.d/motd ]; then +update-rc.d motd defaults >/dev/null || exit $? +fi +if [ -x /etc/init.d/bootlogs ]; then +update-rc.d bootlogs defaults >/dev/null || exit $? fi if [ -x /etc/init.d/rc.local ]; then update-rc.d rc.local defaults >/dev/null || exit $? fi +if [ -x /etc/init.d/rmnologin ]; then +update-rc.d rmnologin defaults >/dev/null || exit $? +fi # # Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12) @@ -210,7 +218,7 @@ if ! mountpoint -q /dev then [ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; } - [ -d /dev/shm ] || { mkdir --mode=1777 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; } + [ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; } fi fi diff -Nru sysvinit-2.88dsf/debian/initscripts.postrm sysvinit-2.88dsf/debian/initscripts.postrm --- sysvinit-2.88dsf/debian/initscripts.postrm 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/initscripts.postrm 2016-06-03 09:31:02.000000000 +0000 @@ -46,7 +46,10 @@ # Remove rc symlinks in the reverse dependency order they were # inserted + update-rc.d rmnologin remove >/dev/null || exit $? update-rc.d rc.local remove >/dev/null || exit $? + update-rc.d motd remove >/dev/null || exit $? + update-rc.d bootlogs remove >/dev/null || exit $? update-rc.d single remove >/dev/null || exit $? update-rc.d killprocs remove >/dev/null || exit $? update-rc.d sendsigs remove >/dev/null || exit $? diff -Nru sysvinit-2.88dsf/debian/rules sysvinit-2.88dsf/debian/rules --- sysvinit-2.88dsf/debian/rules 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/rules 2016-06-23 07:07:39.000000000 +0000 @@ -71,12 +71,12 @@ #$(INSTALL) debian/share/update-rc.d $(sysvtmp)/usr/share/sysvinit/ $(INSTALL) $(tmp)/sbin/init $(sysvinittmp)/lib/sysvinit/ -endif # initscripts package may include /sys ifneq (,$(findstring $(DEB_HOST_ARCH_OS),linux kfreebsd)) $(INSTALL) -d $(inittmp)/sys endif +endif install-arch: build-arch dh $@ $(DH_OPTIONS) @@ -108,10 +108,6 @@ override_dh_installdeb-arch: dh_installdeb - - # Override autogenerated conffiles - $(INSTALL_DATA) debian/initscripts.conffiles \ - $(inittmp)/DEBIAN/conffiles sh debian/deps-mount >> debian/initscripts.substvars ifeq ($(DEB_HOST_ARCH_OS), hurd) diff -Nru sysvinit-2.88dsf/debian/src/initscripts/doc/README.Debian sysvinit-2.88dsf/debian/src/initscripts/doc/README.Debian --- sysvinit-2.88dsf/debian/src/initscripts/doc/README.Debian 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/doc/README.Debian 2016-06-03 09:31:02.000000000 +0000 @@ -1,3 +1,23 @@ +tmpfs +----- + +Tmpfs can be used as virtual memory filesystem. glibc 2.2 and above +expects a tmpfs to be mounted at /run/shm (/dev/shm) for POSIX shared +memory; this is done automatically by /etc/init.d/mountdevsubfs.sh +early in the boot process. A tmpfs will also be mounted on /run as a +writable location available from early boot. Optionally, tmpfs +filesystems may be mounted on /run/lock and /tmp. The tmpfs +filesystems to be mounted are configured in /etc/default/rcS. Please +see rcS(5) for details. + +Size limits may be set of any of the ram file systems (tmpfs) mounted +on /run, /run/lock, /run/shm or /tmp. Please see rcS(5) for details. +Note that /tmp may be a symlink to e.g. /run/tmp, making it possible +to use a single tmpfs for all writable filesystems other than /var; +the directory pointed to by the symlink will be created if it does not +already exist. + + sendsigs process omission interface ----------------------------------- @@ -13,3 +33,20 @@ This feature is only to be used for processes that need to be running when remote file systems are umounted, and that have current working directory set to a directory in the root file system. + + +/sys in /etc/fstab +------------------ + +If the mount point /sys/ has an entry in /etc/fstab (which is not +required, it will be mounted in any case), the entry must be: + + sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0 + +The reason is that the entry in fstab needs to match the entry +generated by the mountkernfs.sh script. If it does not, the system +will complain with this message during boot: + + Will now mount local filesystems:mount: /sys already mounted or /sys busy + mount: according to mtab, sysfs is already mounted on /sys + failed diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/default/tmpfs sysvinit-2.88dsf/debian/src/initscripts/etc/default/tmpfs --- sysvinit-2.88dsf/debian/src/initscripts/etc/default/tmpfs 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/default/tmpfs 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,33 @@ +# Configuration for tmpfs filesystems mounted in early boot, before +# filesystems from /etc/fstab are mounted. For information about +# these variables see the tmpfs(5) manual page. + +# /run is always mounted as a tmpfs on systems which support tmpfs +# mounts. + +# mount /run/lock as a tmpfs (separately from /run). Defaults to yes; +# set to no to disable (/run/lock will then be part of the /run tmpfs, +# if available). +#RAMLOCK=yes + +# mount /run/shm as a tmpfs (separately from /run). Defaults to yes; +# set to no to disable (/run/shm will then be part of the /run tmpfs, +# if available). +#RAMSHM=yes + +# mount /tmp as a tmpfs. Defaults to no; set to yes to enable (/tmp +# will be part of the root filesystem if disabled). /tmp may also be +# configured to be a separate mount in /etc/fstab. +#RAMTMP=no + +# Size limits. Please see tmpfs(5) for details on how to configure +# tmpfs size limits. +#TMPFS_SIZE=20%VM +#RUN_SIZE=10% +#LOCK_SIZE=5242880 # 5MiB +#SHM_SIZE= +#TMP_SIZE= + +# Mount tmpfs on /tmp if there is less than the limit size (in kiB) on +# the root filesystem (overriding RAMTMP). +#TMP_OVERFLOW_LIMIT=1024 diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootlogs sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootlogs --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootlogs 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootlogs 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,60 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: bootlogs +# Required-Start: hostname $local_fs +# Required-Stop: +# Should-Start: $x-display-manager gdm kdm xdm ldm sdm wdm nodm +# Default-Start: 1 2 3 4 5 +# Default-Stop: +# Short-Description: Log file handling to be done during bootup. +# Description: Various things that don't need to be done particularly +# early in the boot, just before getty is run. +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +[ "$DELAYLOGIN" ] || DELAYLOGIN=yes +. /lib/init/vars.sh + +do_start () { + # Save kernel messages in /var/log/dmesg + if which dmesg >/dev/null 2>&1 + then + [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg + dmesg -s 524288 > /var/log/dmesg + chgrp adm /var/log/dmesg || : + elif [ -c /dev/klog ] + then + [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg + dd if=/dev/klog of=/var/log/dmesg & + sleep 1 + kill $! + [ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; } + fi +} + +do_status () { + return 0 +} + +case "$1" in + start|"") + do_start + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + # No-op + ;; + status) + do_status + exit $? + ;; + *) + echo "Usage: bootlogs [start|stop|status]" >&2 + exit 3 + ;; +esac + +: diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootmisc.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootmisc.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootmisc.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/bootmisc.sh 2016-06-03 09:31:02.000000000 +0000 @@ -10,8 +10,6 @@ # Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh. ### END INIT INFO -. /lib/lsb/init-functions - PATH=/sbin:/usr/sbin:/bin:/usr/bin [ "$DELAYLOGIN" ] || DELAYLOGIN=yes . /lib/init/vars.sh diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh 2016-06-03 09:31:02.000000000 +0000 @@ -13,7 +13,6 @@ # masked by future mounts may be cleaned. ### END INIT INFO -. /lib/lsb/init-functions . /lib/init/bootclean.sh case "$1" in diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/motd sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/motd --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/motd 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/motd 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: motd +# Required-Start: hostname $local_fs +# Required-Stop: +# Should-Start: +# Default-Start: 1 2 3 4 5 +# Default-Stop: +# Short-Description: Create dynamic part of /etc/motd +# Description: /etc/motd is user-editable and static. This script +# creates the initial dynamic part, by default the +# output of uname, and stores it in /var/run/motd.dynamic. +# Both parts are output by pam_motd. +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +. /lib/init/vars.sh + +do_start () { + # Update motd + uname -snrvm > /var/run/motd.dynamic +} + +do_status () { + if [ -f /var/run/motd.dynamic ] ; then + return 0 + else + return 4 + fi +} + +case "$1" in + start|"") + do_start + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + # No-op + ;; + status) + do_status + exit $? + ;; + *) + echo "Usage: motd [start|stop|status]" >&2 + exit 3 + ;; +esac + +: diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall-bootclean.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall-bootclean.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall-bootclean.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall-bootclean.sh 2016-06-03 09:31:02.000000000 +0000 @@ -11,7 +11,6 @@ # all local filesystems have been mounted. ### END INIT INFO -. /lib/lsb/init-functions . /lib/init/bootclean.sh case "$1" in diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh 2016-06-03 09:31:02.000000000 +0000 @@ -10,10 +10,10 @@ ### END INIT INFO PATH=/sbin:/bin -. /lib/lsb/init-functions . /lib/init/vars.sh . /lib/init/tmpfs.sh +. /lib/lsb/init-functions . /lib/init/mount-functions.sh . /lib/init/swap-functions.sh diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountdevsubfs.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountdevsubfs.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountdevsubfs.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountdevsubfs.sh 2016-06-03 09:31:02.000000000 +0000 @@ -21,10 +21,10 @@ KERNEL="$(uname -s)" -. /lib/lsb/init-functions . /lib/init/vars.sh . /lib/init/tmpfs.sh +. /lib/lsb/init-functions . /lib/init/mount-functions.sh # May be run several times, so must be idempotent. diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountkernfs.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountkernfs.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountkernfs.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountkernfs.sh 2016-06-03 09:31:02.000000000 +0000 @@ -12,10 +12,10 @@ ### END INIT INFO PATH=/sbin:/bin -. /lib/lsb/init-functions . /lib/init/vars.sh . /lib/init/tmpfs.sh +. /lib/lsb/init-functions . /lib/init/mount-functions.sh # May be run several times, so must be idempotent. diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh 2016-06-03 09:31:02.000000000 +0000 @@ -11,7 +11,6 @@ # network filesystems have been mounted. ### END INIT INFO -. /lib/lsb/init-functions . /lib/init/bootclean.sh case "$1" in diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs.sh 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountnfs.sh 2016-06-03 09:31:02.000000000 +0000 @@ -13,9 +13,9 @@ # for them to be mounted before carrying on. ### END INIT INFO -. /lib/lsb/init-functions . /lib/init/vars.sh . /lib/init/mount-functions.sh +. /lib/lsb/init-functions do_wait_async_mount() { # Read through fstab line by line. If it is NFS, set the flag diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/ondemand sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/ondemand --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/ondemand 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/ondemand 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: ondemand -# Required-Start: $remote_fs $all -# Required-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: -# Short-Description: Set the CPU Frequency Scaling governor to "ondemand" -### END INIT INFO - -# Don't run if we're going to start an Android LXC container: -[ ! -f /etc/init/lxc-android-config.conf ] || exit 0 - -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -. /lib/init/vars.sh -. /lib/lsb/init-functions - -FIRSTCPU=`cat /sys/devices/system/cpu/online | sed 's/[-,].*//g'` -AVAILABLE="/sys/devices/system/cpu/cpu$FIRSTCPU/cpufreq/scaling_available_governors" -DOWN_FACTOR="/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor" - -case "$1" in - start) - start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background - ;; - background) - sleep 60 # probably enough time for desktop login - - [ -f $AVAILABLE ] || exit 0 - read governors < $AVAILABLE - case $governors in - *interactive*) - GOVERNOR="interactive" - break - ;; - *ondemand*) - GOVERNOR="ondemand" - case $(uname -m) in - ppc64*) - SAMPLING=100 - ;; - esac - break - ;; - *powersave*) - GOVERNOR="powersave" - break - ;; - *) - exit 0 - ;; - esac - - for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor - do - [ -f $CPUFREQ ] || continue - echo -n $GOVERNOR > $CPUFREQ - done - if [ -n "$SAMPLING" ] && [ -f $DOWN_FACTOR ]; then - echo -n $SAMPLING > $DOWN_FACTOR - fi - ;; - restart|reload|force-reload) - echo "Error: argument '$1' not supported" >&2 - exit 3 - ;; - stop) - ;; - *) - echo "Usage: $0 start|stop" >&2 - exit 3 - ;; -esac diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/rmnologin sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/rmnologin --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/rmnologin 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/rmnologin 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,59 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: rmnologin +# Required-Start: $remote_fs $all +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Remove /run/nologin at boot +# Description: This script removes the /run/nologin file as the +# last step in the boot process, if DELAYLOGIN=yes. +# If DELAYLOGIN=no, /run/nologin was not created by +# bootmisc earlier in the boot process. +### END INIT INFO + +PATH=/sbin:/bin +[ "$DELAYLOGIN" ] || DELAYLOGIN=yes +. /lib/init/vars.sh + +do_start () { + # + # If login delaying is enabled then remove the flag file + # + case "$DELAYLOGIN" in + Y*|y*) + rm -f /run/nologin + ;; + esac +} + +do_status () { + if [ ! -f /run/nologin ] ; then + return 0 + else + return 4 + fi +} + +case "$1" in + start) + do_start + ;; + restart|reload|force-reload) + echo "Error: argument '$1' not supported" >&2 + exit 3 + ;; + stop) + # No-op + ;; + status) + do_status + exit $? + ;; + *) + echo "Usage: $0 start|stop" >&2 + exit 3 + ;; +esac + +: diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/network/if-up.d/mountnfs sysvinit-2.88dsf/debian/src/initscripts/etc/network/if-up.d/mountnfs --- sysvinit-2.88dsf/debian/src/initscripts/etc/network/if-up.d/mountnfs 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/network/if-up.d/mountnfs 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,185 @@ +#! /bin/sh +# Description: Now that TCP/IP is configured, mount the NFS file +# systems in /etc/fstab if needed. If possible, +# start the portmapper before mounting (this is needed for +# Linux 2.1.x and up). +# +# Also mounts SMB filesystems now, so the name of +# this script is getting increasingly inaccurate. + +# Skip the mountnfs hook when being triggered by the networking SysV init +# script and instead use the systemd built-in mechanisms to mount remote +# file systems. +# This avoids a deadlock caused by the rpcbind SysV init script depending +# on $network and the $network LSB facility being provided by the networking +# SysV init script. +if [ -d /run/systemd/system ]; then + systemctl list-jobs | grep -q network.target && exit 0 +fi + +PATH=/sbin:/bin +. /lib/init/vars.sh + +. /lib/lsb/init-functions +. /lib/init/mount-functions.sh + +set_env() { + # Read through fstab line by line. If it is NFS, set the flag + # for mounting NFS file systems. If any NFS partition is found + # and it not mounted with the nolock option, we start the + # portmapper. + # + # If any sec={krb5,krb5i,krb5p} option is given, or any of the + # file systems are nfs4, we'll need to start rpc.gssd and/or + # rpc.idmapd too; we'll leave that to nfs-common. + + start_nfs=no + NETFS="" + NETDEV="" + for file in "$(eval ls $(fstab_files))"; do + if [ -f "$file" ]; then + while read DEV MTPT FSTYPE OPTS REST; do + case "$DEV" in + ""|\#*) + continue + ;; + esac + case "$OPTS" in + noauto|*,noauto|noauto,*|*,noauto,*) + continue + ;; + _netdev|*,_netdev|_netdev,*|*,_netdev,*) + NETDEV=yes + ;; + esac + case "$FSTYPE" in + nfs) + # NFS filsystems normally + # require statd and + # portmap. However, if nolock + # is set, portmap and statd + # are not required for this + # file system. + case "$OPTS" in + nolock|*,nolock|nolock,*|*,nolock,*) + # no action + ;; + *) + start_nfs=yes + ;; + esac + + # However, Kerberos requires + # gssd, so start nfs-common + # anyway. + case "$OPTS" in + sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*) + start_nfs=yes + ;; + esac + ;; + nfs4) + # NFSv4 requires idmapd, so + # start nfs-common no matter + # what the options are. + start_nfs=yes + ;; + smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs|ceph) + ;; + *) + FSTYPE= + ;; + esac + if [ "$FSTYPE" ]; then + case "$NETFS" in + $FSTYPE|*,$FSTYPE|$FSTYPE,*|*,$FSTYPE,*) + ;; + *) + NETFS="$NETFS${NETFS:+,}$FSTYPE" + ;; + esac + fi + done < "$file" + fi + done +} + +do_start() { + # + # Initialize nfs-common (which starts rpc.statd, rpc.gssd + # and/or rpc.idmapd, and loads the right kernel modules if + # applicable) if we use Kerberos and/or NFSv4 mounts. + # + if [ "$start_nfs" = yes ] && [ -x /etc/init.d/nfs-common ] + then + [ -x /etc/init.d/portmap ] && /etc/init.d/portmap start + [ -x /etc/init.d/rpcbind ] && /etc/init.d/rpcbind start + /etc/init.d/nfs-common start + fi + + pre_mountall + if [ "$NETFS" ] + then + mount -a -t$NETFS + fi + if [ "$NETDEV" ]; then + mount -a -O _netdev + fi + post_mountall +} + +exit_unless_last_interface() { + ifaces="$(ifquery --list)" + for i in $ifaces ; do + if [ "$i" = "lo" ]; then + continue + fi + if ! ifquery --state $i >/dev/null ; then + msg="if-up.d/mountnfs[$IFACE]: waiting for interface $i before doing NFS mounts" + log_warning_msg "$msg" + exit 0 + fi + done +} + +# Using 'no !=' instead of 'yes =' to make sure async nfs mounting is +# the default even without a value in /etc/default/rcS +set_env +# Exit imediately and do not claim to wait for the last interface if +# no network file systems are listed in /etc/fstab. +if [ "$start_nfs" = "no" ] && [ ! "$NETFS" ] && [ ! "$NETDEV" ]; then + exit 0 +fi + +if [ no != "$ASYNCMOUNTNFS" ]; then + # Not for loopback! + [ "$IFACE" != "lo" ] || exit 0 + + [ "$ADDRFAM" = "inet" ] || [ "$ADDRFAM" = "inet6" ] || exit 0 + + # Lock around this otherwise insanity may occur + mkdir /var/run/network 2>/dev/null || true + + # Wait until all auto interfaces are up before attemting to mount + # network file systems. + exit_unless_last_interface + + if mkdir /var/run/network/mountnfs 2>/dev/null ; then + : + else + msg="if-up.d/mountnfs[$IFACE]: lock /var/run/network/mountnfs exist, not mounting" + log_failure_msg "$msg" + # Log if /usr/ is mounted + [ -x /usr/bin/logger ] && /usr/bin/logger -t "if-up.d/mountnfs[$IFACE]" "$msg" + exit 0 + fi + + on_exit() { + # Clean up lock when script exits, even if it is interrupted + rmdir /var/run/network/mountnfs 2>/dev/null || exit 0 + } + trap on_exit EXIT # Enable emergency handler + do_start +elif [ yes = "$FROMINITD" ] ; then + do_start +fi diff -Nru sysvinit-2.88dsf/debian/src/initscripts/lib/init/bootclean.sh sysvinit-2.88dsf/debian/src/initscripts/lib/init/bootclean.sh --- sysvinit-2.88dsf/debian/src/initscripts/lib/init/bootclean.sh 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/lib/init/bootclean.sh 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,181 @@ +# bootclean +# +# Clean /tmp, /run and /var/lock if not mounted as tmpfs +# +# DO NOT RUN AFTER S:55bootmisc.sh and do not run this script directly +# in runlevel S. Instead write an initscript to call it. +# + +. /lib/init/vars.sh +. /lib/lsb/init-functions + +# Should be called outside verbose message block +mkflagfile() +{ + # Prevent symlink attack (See #264234.) + [ -L "$1" ] && log_warning_msg "bootclean: Deleting symbolic link '$1'." + rm -f "$1" || { log_failure_msg "bootclean: Failure deleting '$1'." ; return 1 ; } + # No user processes should be running, so no one should be + # able to introduce a symlink here. As an extra precaution, + # set noclobber. + set -o noclobber + :> "$1" || { log_failure_msg "bootclean: Failure creating '$1'." ; return 1 ; } + return 0 +} + +checkflagfile() +{ + if [ -f $1/.clean ] + then + which stat >/dev/null 2>&1 && cleanuid="$(stat -c %u $1/.clean)" + # Poor's man stat %u, since stat (and /usr) might not + # be available in some bootup stages + [ "$cleanuid" ] || cleanuid="$(find $1/.clean -printf %U)" + [ "$cleanuid" ] || { log_failure_msg "bootclean: Could not stat '$1/.clean'." ; return 1 ; } + if [ "$cleanuid" -ne 0 ] + then + rm -f $1/.clean || { log_failure_msg "bootclean: Could not delete '$1/.clean'." ; return 1 ; } + fi + fi + return 0 +} + + report_err() + { + dir="$1" + if [ "$VERBOSE" = no ] + then + log_failure_msg "bootclean: Failure cleaning ${dir}." + else + log_action_end_msg 1 "bootclean: Failure cleaning ${dir}" + fi + } + +clean_tmp() { + # Does not exist + [ -d /tmp ] || return 1 + # tmpfs does not require cleaning + [ -f /tmp/.tmpfs ] && return 0 + # Can clean? + checkflagfile /tmp || return 0 + # Already cleaned + [ -f /tmp/.clean ] && return 0 + # Can't clean yet? + which find >/dev/null 2>&1 || return 1 + + cd /tmp || { log_failure_msg "bootclean: Could not cd to /tmp." ; return 1 ; } + + # + # Only clean out /tmp if it is world-writable. This ensures + # it really is a/the temp directory we're cleaning. + # + [ "$(find . -maxdepth 0 -perm -002)" = "." ] || return 0 + + if [ ! "$TMPTIME" ] + then + log_warning_msg "Using default TMPTIME 0." + TMPTIME=0 + fi + + [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning /tmp" + + # + # Remove regardless of TMPTIME setting + # + rm -f .X*-lock + + # + # Don't clean remaining files if TMPTIME is negative or 'infinite' + # + case "$TMPTIME" in + -*|infinite|infinity) + [ "$VERBOSE" = no ] || log_action_end_msg 0 "skipped" + return 0 + ;; + esac + + # + # Wipe /tmp, excluding system files, but including lost+found + # + # If TMPTIME is set to 0, we do not use any ctime expression + # at all, so we can also delete files with timestamps + # in the future! + # + if [ "$TMPTIME" = 0 ] + then + TEXPR="" + DEXPR="" + else + TEXPR="-mtime +$TMPTIME -ctime +$TMPTIME -atime +$TMPTIME" + DEXPR="-mtime +$TMPTIME -ctime +$TMPTIME" + fi + + EXCEPT='! -name . + ! ( -path ./lost+found -uid 0 ) + ! ( -path ./quota.user -uid 0 ) + ! ( -path ./aquota.user -uid 0 ) + ! ( -path ./quota.group -uid 0 ) + ! ( -path ./aquota.group -uid 0 ) + ! ( -path ./.journal -uid 0 ) + ! ( -path ./.clean -uid 0 ) + ! ( -path './...security*' -uid 0 )' + + mkflagfile /tmp/.clean || return 1 + + # + # First remove all old files... + # + find . -depth -xdev $TEXPR $EXCEPT ! -type d -delete \ + || { report_err "/tmp"; return 1 ; } + + # + # ...and then all empty directories + # + find . -depth -xdev $DEXPR $EXCEPT -type d -empty -delete \ + || { report_err "/tmp"; return 1 ; } + + [ "$VERBOSE" = no ] || log_action_end_msg 0 + log_progress_msg "/tmp" + return 0 +} + +clean() { + dir="$1" + findopts="$2" + + # Does not exist + [ -d "$dir" ] || return 1 + # tmpfs does not require cleaning + [ -f "$dir/.tmpfs" ] && return 0 + # Can clean? + checkflagfile "$dir" || return 0 + # Already cleaned + [ -f "${dir}/.clean" ] && return 0 + # Can't clean yet? + which find >/dev/null 2>&1 || return 1 + + cd "$dir" || { log_action_end_msg 1 "bootclean: Could not cd to ${dir}." ; return 1 ; } + + [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning $dir" + + find . $findopts -delete \ + || { report_err "$dir"; return 1 ; } + [ "$VERBOSE" = no ] || log_action_end_msg 0 + mkflagfile "${dir}/.clean" || return 1 + log_progress_msg "$dir" + return 0 +} + +clean_all() +{ + which find >/dev/null 2>&1 || return 0 + log_begin_msg "Cleaning up temporary files..." + ES=0 + clean_tmp || ES=1 + clean /run "! -xtype d ! -name utmp ! -name innd.pid" || ES=1 + clean /run/lock "! -type d" || ES=1 + clean /run/shm "! -type d" || ES=1 + log_end_msg $ES + return $ES +} + diff -Nru sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh --- sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,676 @@ +# +# Functions used by several mount* scripts in initscripts package +# +# Sourcer must source /lib/lsb/init-functions.sh + +# List available fstab files, including any files in /etc/fstab.d. +# This looks ugly, but we can't use find and it's safer than globbing. +fstab_files() +{ + echo /etc/fstab + if [ -d /etc/fstab.d ]; then + ls -1 /etc/fstab.d | grep '\.fstab$' | sed -e 's;^;/etc/fstab.d/;' + fi +} + +# $1: directory +is_empty_dir() { + for FILE in $1/* $1/.* + do + case "$FILE" in + "$1/.*") return 0 ;; + "$1/*"|"$1/."|"$1/..") continue ;; + *) return 1 ;; + esac + done + return 0 +} + + +selinux_enabled () { + which selinuxenabled >/dev/null 2>&1 && selinuxenabled +} + +# Read /etc/fstab, looking for: +# 1) The root filesystem, resolving LABEL=*|UUID=* entries to the +# device node, +# 2) Swap that is on a md device or a file that may be on a md +# device, +_read_fstab () { + echo "fstabroot=/dev/root" + echo "rootdev=none" + echo "roottype=none" + echo "rootopts=defaults" + echo "rootmode=rw" + echo "rootcheck=no" + echo "swap_on_lv=no" + echo "swap_on_file=no" + + fstab_files | while read file; do + if [ -f "$file" ]; then + while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK; do + case "$DEV" in + ""|\#*) + continue; + ;; + /dev/mapper/*) + [ "$FSTYPE" = "swap" ] && echo swap_on_lv=yes + ;; + /dev/*) + ;; + LABEL=*|UUID=*) + if [ "$MTPT" = "/" ] && [ -x /sbin/findfs ] + then + DEV="$(findfs "$DEV")" + fi + ;; + /*) + [ "$FSTYPE" = "swap" ] && echo swap_on_file=yes + ;; + *) + ;; + esac + [ "$MTPT" != "/" ] && continue + echo rootdev=\"$DEV\" + echo fstabroot=\"$DEV\" + echo rootopts=\"$OPTS\" + echo roottype=\"$FSTYPE\" + ( [ "$PASS" != 0 ] && [ "$PASS" != "" ] ) && echo rootcheck=yes + ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE" = "nfs4" ] ) && echo rootcheck=no + case "$OPTS" in + ro|ro,*|*,ro|*,ro,*) + echo rootmode=ro + ;; + esac + done < "$file" + fi + done +} + +# Read /etc/fstab, looking for: +# 1) The root filesystem, resolving LABEL=*|UUID=* entries to the +# device node, +# 2) Swap that is on a md device or a file that may be on a md +# device, + +read_fstab () { + eval "$(_read_fstab)" +} + +# Find a specific fstab entry +# $1=mountpoint +# $2=fstype (optional) +_read_fstab_entry () { + # Not found by default. + echo "MNT_FSNAME=" + echo "MNT_DIR=" + echo "MNT_TYPE=" + echo "MNT_OPTS=" + echo "MNT_FREQ=" + echo "MNT_PASS=" + + fstab_files | while read file; do + if [ -f "$file" ]; then + while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do + case "$MNT_FSNAME" in + ""|\#*) + continue; + ;; + esac + if [ "$MNT_DIR" = "$1" ]; then + if [ -n "$2" ]; then + [ "$MNT_TYPE" = "$2" ] || continue; + fi + echo "MNT_FSNAME=$MNT_FSNAME" + echo "MNT_DIR=$MNT_DIR" + echo "MNT_TYPE=$MNT_TYPE" + echo "MNT_OPTS=$MNT_OPTS" + echo "MNT_FREQ=$MNT_FREQ" + echo "MNT_PASS=$MNT_PASS" + break 2 + fi + MNT_DIR="" + done < "$file" + fi + done +} + +# Find a specific fstab entry +# $1=mountpoint +# $2=fstype (optional) +# returns 0 on success, 1 on failure (not found or no fstab) +read_fstab_entry () { + eval "$(_read_fstab_entry "$1" "$2")" + + # Not found by default. + found=1 + if [ "$1" = "$MNT_DIR" ]; then + found=0 + fi + + return $found +} + +# Mount kernel and device file systems. +# $1: mount mode (mount, remount) +# $2: file system type +# $3: alternative file system type (or empty string if none) +# $4: mount point +# $5: mount device name +# $6... : extra mount program options +domount () { + MOUNTMODE="$1" + PRIFSTYPE="$2" + ALTFSTYPE="$3" + MTPT="$4" + DEVNAME="$5" + CALLER_OPTS="$6" + + KERNEL="$(uname -s)" + # Figure out filesystem type from primary and alternative type + FSTYPE= + # Filesystem-specific mount options + FS_OPTS= + # Mount options from fstab + FSTAB_OPTS= + + if [ "$PRIFSTYPE" = proc ]; then + case "$KERNEL" in + Linux) FSTYPE=proc ;; + GNU) FSTYPE=proc; FS_OPTS="-ocompatible" ;; + *FreeBSD) FSTYPE=linprocfs ;; + *) FSTYPE=procfs ;; + esac + elif [ "$PRIFSTYPE" = bind ]; then + case "$KERNEL" in + Linux) FSTYPE="$DEVNAME"; FS_OPTS="-obind" ;; + *FreeBSD) FSTYPE=nullfs ;; + GNU) FSTYPE=firmlink ;; + *) FSTYPE=none ;; + esac + elif [ "$PRIFSTYPE" = tmpfs ]; then + # always accept tmpfs, to mount /run before /proc + case "$KERNEL" in + *) FSTYPE=$PRIFSTYPE ;; + esac + elif grep -E -qs "$PRIFSTYPE\$" /proc/filesystems; then + FSTYPE=$PRIFSTYPE + elif grep -E -qs "$ALTFSTYPE\$" /proc/filesystems; then + FSTYPE=$ALTFSTYPE + fi + + # Filesystem not supported by kernel + if [ ! "$FSTYPE" ]; then + if [ "$ALTFSTYPE" ]; then + log_warning_msg "Filesystem types '$PRIFSTYPE' and '$ALTFSTYPE' are not supported. Skipping mount." + else + log_warning_msg "Filesystem type '$PRIFSTYPE' is not supported. Skipping mount." + fi + return + fi + + # We give file system type as device name if not specified as + # an argument + if [ -z "$DEVNAME" ] ; then + DEVNAME=$FSTYPE + fi + + # Get the mount options from /etc/fstab + if read_fstab_entry "$MTPT" "$FSTYPE"; then + case "$MNT_OPTS" in + noauto|*,noauto|noauto,*|*,noauto,*) + return + ;; + ?*) + FSTAB_OPTS="-o$MNT_OPTS" + ;; + esac + fi + + if [ ! -d "$MTPT" ] + then + log_warning_msg "Mount point '$MTPT' does not exist. Skipping mount." + return + fi + + if [ "$MOUNTMODE" = "mount_noupdate" ]; then + MOUNTFLAGS="-n" + MOUNTMODE=mount + fi + if [ "$MOUNTMODE" = "remount_noupdate" ]; then + MOUNTFLAGS="-n" + MOUNTMODE=remount + fi + + case "$MOUNTMODE" in + mount) + if mountpoint -q "$MTPT"; then + # Already mounted, probably moved from the + # initramfs, so remount with the + # user-specified mount options later on. + : + else + if [ "$VERBOSE" != "no" ]; then + is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden." + fi + mount $MOUNTFLAGS -t $FSTYPE $CALLER_OPTS $FSTAB_OPTS $FS_OPTS $DEVNAME $MTPT + if [ "$FSTYPE" = "tmpfs" -a -x /sbin/restorecon ]; then + /sbin/restorecon $MTPT + fi + fi + ;; + remount) + if mountpoint -q "$MTPT"; then + # Remount with user-specified mount options + mount $MOUNTFLAGS -oremount $CALLER_OPTS $FSTAB_OPTS $MTPT + fi + ;; + esac +} + +# +# Preserve /var/run and /var/lock mountpoints +# +pre_mountall () +{ + : +} + +# If the device/inode are the same, a bind mount already exists or the +# transition is complete, so set up is not required. Otherwise bind +# mount $SRC on $DEST. +bind_mount () +{ + SRC=$1 + DEST=$2 + + FSTYPE="" + OPTS="" + + ssrc="$(/usr/bin/stat -L --format="%d %i" "$SRC" 2>/dev/null || :)" + sdest="$(/usr/bin/stat -L --format="%d %i" "$DEST" 2>/dev/null || :)" + + case "$(uname -s)" in + Linux) FSTYPE=$SRC; OPTS="-orw -obind" ;; + *FreeBSD) FSTYPE=nullfs; OPTS="-orw" ;; + GNU) FSTYPE=firmlink ;; + *) FSTYPE=none ;; + esac + + # Bind mount $SRC on $DEST + if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then + [ -d "$DEST" ] || mkdir "$DEST" + [ -x /sbin/restorecon ] && /sbin/restorecon "$DEST" + if mount -t $FSTYPE "$SRC" "$DEST" $OPTS ; then + echo "Please reboot to complete migration to tmpfs-based /run" > "${DEST}/.run-transition" + return 0 + fi + return 1 + fi + + return 0 +} + +# +# Migrate a directory to /run and create compatibility symlink or bind +# mount. +# +run_migrate () +{ + OLD=$1 + RUN=$2 + + KERNEL="$(uname -s)" + OPTS="" + case "$KERNEL" in + Linux) FSTYPE=none OPTS="-orw -obind";; + *FreeBSD) FSTYPE=nullfs OPTS="-orw" ;; + GNU) FSTYPE=firmlink ;; + *) FSTYPE=none ;; + esac + + # Create absolute symlink if not already present. This is to + # upgrade from older versions which created relative links, + # which are not permitted in policy between top-level + # directories. + if [ -L "$OLD" ] && [ "$(readlink "$OLD")" != "$RUN" ]; then + rm -f "$OLD" + ln -fs "$RUN" "$OLD" + [ -x /sbin/restorecon ] && /sbin/restorecon "$OLD" + fi + + # If both directories are the same, we don't need to do + # anything further. + sold="$(/usr/bin/stat -L --format="%d %i" "$OLD" 2>/dev/null || :)" + srun="$(/usr/bin/stat -L --format="%d %i" "$RUN" 2>/dev/null || :)" + if [ -n "$sold" ] && [ "$sold" = "$srun" ]; then + return 0 + fi + + # Try to remove if a directory. Note this is safe because the + # system is not yet fully up, and nothing is allowed to use + # them yet. If the user explicitly mounted a filesystem here, + # it will be cleaned out, but this would happen later on when + # bootclean runs in any case. + if [ ! -L "$OLD" ] && [ -d "$OLD" ] ; then + rm -fr "$OLD" 2>/dev/null || true + fi + + # If removal failed (directory still exists), set up bind mount. + if [ ! -L "$OLD" ] && [ -d "$OLD" ] ; then + if [ "$OLD" != "/tmp" ]; then + log_warning_msg "Filesystem mounted on $OLD; setting up compatibility bind mount." + log_warning_msg "Please remove this mount from /etc/fstab; it is no longer needed, and it is preventing completion of the transition to $RUN." + fi + mount -t $FSTYPE "$RUN" "$OLD" $OPTS + else + # Create symlink if not already present. + if [ -L "$OLD" ] && [ "$(readlink "$OLD")" != "$RUN" ]; then + : + else + rm -f "$OLD" + ln -fs "$RUN" "$OLD" + [ -x /sbin/restorecon ] && /sbin/restorecon "$OLD" + fi + fi + + return 0 +} + +# +# Migrate /etc/mtab to a compatibility symlink +# +mtab_migrate () +{ + # Don't symlink if /proc/mounts does not exist. + if [ ! -r "/proc/mounts" ]; then + return 1 + fi + + # Create symlink if not already present. + if [ -L "/etc/mtab" ] && [ "$(readlink "/etc/mtab")" = "/proc/mounts" ]; then + : + else + log_warning_msg "Creating compatibility symlink from /etc/mtab to /proc/mounts." + + rm -f "/etc/mtab" || return 1 + ln -fs "/proc/mounts" "/etc/mtab" || return 1 + [ -x /sbin/restorecon ] && /sbin/restorecon "/etc/mtab" + fi + + return 0 +} + +# +# For compatibility, create /var/run and /var/lock symlinks to /run +# and /run/lock, respectively. +# +post_mountall () +{ + # /var/run and /var/lock are now /run and /run/lock, + # respectively. Cope with filesystems being deliberately + # mounted on /var/run and /var/lock. We will create bind + # mounts from /run and /run/lock to /var/run and /var/lock if + # we can't remove the /var/run and /var/lock directories, or + # else simply create symlinks. For example, in the case that + # the user has explicitly mounted filesystems on /var/run or + # /var/lock, we bind mount over the top of them. Where no + # filesystems are mounted, we replace the directory with a + # symlink where possible. + + # Cater for systems which have a symlink from /run to /var/run + # for whatever reason. Remove the symlink and replace with a + # directory. The migration logic will then take care of the + # rest. Note that it will take a second boot to fully + # migrate; it should only ever be needed on broken systems. + RAMSHM_ON_DEV_SHM="no" + if read_fstab_entry "/dev/shm"; then + RAMSHM_ON_DEV_SHM="yes" + fi + if read_fstab_entry "/run/shm"; then + RAMSHM_ON_DEV_SHM="no" + fi + + if [ -L /run ]; then + if [ "$(readlink /run)" = "/var/run" ]; then + rm -f /run + mkdir /run + fi + if bind_mount /var/run /run; then + bind_mount /var/lock /run/lock + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi + fi + else + run_migrate /var/run /run + run_migrate /var/lock /run/lock + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi + fi +} + +# Mount /run +mount_run () +{ + MNTMODE="$1" + + # Needed to determine if root is being mounted read-only. + read_fstab + + # + # Get some writable area available before the root is checked + # and remounted. Note that /run may be handed over from the + # initramfs. + # + + # If /run/shm is separately mounted, /run can be safely mounted noexec. + RUNEXEC= + if [ yes = "$RAMSHM" ] || read_fstab_entry /run/shm tmpfs; then + RUNEXEC=',noexec' + fi + # TODO: Add -onodev once checkroot no longer creates a device node. + domount "$MNTMODE" tmpfs shmfs /run tmpfs "-onosuid$RUNEXEC$RUN_OPT" + [ -x /sbin/restorecon ] && /sbin/restorecon -r /run + + # Make pidfile omit directory for sendsigs + [ -d /run/sendsigs.omit.d ] || mkdir --mode=755 /run/sendsigs.omit.d/ + + # Make sure we don't get cleaned + touch /run/.tmpfs +} + +# Mount /run/lock +mount_lock () +{ + MNTMODE="$1" + + # Make lock directory as the replacement for /var/lock + [ -d /run/lock ] || mkdir --mode=755 /run/lock + [ -x /sbin/restorecon ] && /sbin/restorecon /run/lock + + # Now check if there's an entry in /etc/fstab. If there is, + # it overrides the existing RAMLOCK setting. + if read_fstab_entry /run/lock; then + if [ "$MNT_TYPE" = "tmpfs" ] ; then + RAMLOCK="yes" + else + RAMLOCK="no" + fi + fi + + KERNEL="$(uname -s)" + NODEV="nodev," + case "$KERNEL" in + *FreeBSD|GNU) NODEV="" ;; + esac + + # Mount /run/lock as tmpfs if enabled. This prevents user DoS + # of /run by filling /run/lock at the expense of using an + # additional tmpfs. + if [ yes = "$RAMLOCK" ]; then + domount "$MNTMODE" tmpfs shmfs /run/lock tmpfs "-o${NODEV}noexec,nosuid$LOCK_OPT" + # Make sure we don't get cleaned + touch /run/lock/.tmpfs + else + chmod "$LOCK_MODE" /run/lock + fi +} + +# Mount /run/shm +mount_shm () +{ + MNTMODE="$1" + + RAMSHM_ON_DEV_SHM="no" + SHMDIR="/run/shm" + if read_fstab_entry "/dev/shm"; then + if [ "$MNTMODE" = "mount_noupdate" ]; then + log_warning_msg "Warning: fstab entry for /dev/shm; should probably be for /run/shm unless working around a bug in the Oracle database" + fi + SHMDIR="/dev/shm" + RAMSHM_ON_DEV_SHM="yes" + fi + if read_fstab_entry "/run/shm"; then + if [ "$MNTMODE" = "mount_noupdate" ] && [ "$RAMSHM_ON_DEV_SHM" = "yes" ]; then + log_warning_msg "Warning: fstab entries for both /dev/shm and /run/shm found; only /run/shm will be used" + fi + + SHMDIR="/run/shm" + RAMSHM_ON_DEV_SHM="no" + fi + + if [ ! -d "$SHMDIR" ] + then + mkdir --mode=755 "$SHMDIR" + [ -x /sbin/restorecon ] && /sbin/restorecon "$SHMDIR" + fi + + # Now check if there's an entry in /etc/fstab. If there is, + # it overrides the existing RAMSHM setting. + if read_fstab_entry "$SHMDIR"; then + if [ "$MNT_TYPE" = "tmpfs" ] ; then + RAMSHM="yes" + else + RAMSHM="no" + fi + fi + + KERNEL="$(uname -s)" + NODEV="nodev," + case "$KERNEL" in + *FreeBSD|GNU) NODEV="" ;; + esac + + if [ yes = "$RAMSHM" ]; then + domount "$MNTMODE" tmpfs shmfs "$SHMDIR" tmpfs "-onosuid,${NODEV}noexec$SHM_OPT" + # Make sure we don't get cleaned + touch "$SHMDIR"/.tmpfs + else + chmod "$SHM_MODE" "$SHMDIR" + fi + + # Migrate early, so /dev/shm is available from the start + if [ "$MNTMODE" = mount_noupdate ] || [ "$MNTMODE" = mount ]; then + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi + fi +} + +# +# Mount /tmp +# +mount_tmp () +{ + MNTMODE="$1" + + # If /tmp is a symlink, make sure the linked-to directory exists. + if [ -L /tmp ] && [ ! -d /tmp ]; then + TMPPATH="$(readlink /tmp)" + mkdir -p --mode=755 "$TMPPATH" + [ -x /sbin/restorecon ] && /sbin/restorecon "$TMPPATH" + fi + + # Disable RAMTMP if there's 64MiB RAM or less. May be + # re-enabled by overflow or read only root, below. + RAM_SIZE="$(ram_size)" + if [ -n "$RAM_SIZE" ] && [ "$((RAM_SIZE <= 65536))" = "1" ]; then + RAMTMP=no + fi + + # If root is read only, default to mounting a tmpfs on /tmp, + # unless one is due to be mounted from fstab. + if [ "$RAMTMP" != "yes" ] && [ rw != "$rootmode" ]; then + # If there's an entry in fstab for /tmp (any + # filesystem type, not just tmpfs), then we don't need + # a tmpfs on /tmp by default. + if read_fstab_entry /tmp ; then + : + else + log_warning_msg "Root filesystem is read-only; mounting tmpfs on /tmp" + RAMTMP="yes" + fi + fi + + if [ "$RAMTMP" != "yes" ] && need_overflow_tmp; then + # If there's an entry in fstab for /tmp (any + # filesystem type, not just tmpfs), then we don't need + # a tmpfs on /tmp by default. + if read_fstab_entry /tmp ; then + : + else + log_warning_msg "Root filesystem has insufficient free space; mounting tmpfs on /tmp" + RAMTMP="yes" + fi + fi + + # Now check if there's an entry in /etc/fstab. If there is, + # it overrides all the above settings. + if read_fstab_entry /tmp; then + if [ "$MNT_TYPE" = "tmpfs" ] ; then + RAMTMP="yes" + else + RAMTMP="no" + fi + fi + + KERNEL="$(uname -s)" + NODEV="nodev," + case "$KERNEL" in + *FreeBSD|GNU) NODEV="" ;; + esac + + # Mount /tmp as tmpfs if enabled. + if [ yes = "$RAMTMP" ]; then + domount "$MNTMODE" tmpfs shmfs /tmp tmpfs "-o${NODEV}nosuid$TMP_OPT" + # Make sure we don't get cleaned + touch /tmp/.tmpfs + else + # When root is still read only, this will fail. + if [ mount_noupdate != "$MNTMODE" ] && [ rw = "$rootmode" ]; then + chmod "$TMP_MODE" /tmp + fi + fi +} + +is_fastboot_active() { + if [ -f /fastboot ] ; then + return 0 + fi + for cmd in $(cat /proc/cmdline) ; do + case "$cmd" in + fastboot) + return 0 + ;; + esac + done + return 1 +} diff -Nru sysvinit-2.88dsf/debian/src/initscripts/lib/init/swap-functions.sh sysvinit-2.88dsf/debian/src/initscripts/lib/init/swap-functions.sh --- sysvinit-2.88dsf/debian/src/initscripts/lib/init/swap-functions.sh 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/lib/init/swap-functions.sh 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,28 @@ +# +# Functions that assist in turning on swap. +# + +# $1 is a string used to log the type of swap expected to be activated +swaponagain() { + # + # Execute swapon command again to pick up any swap partitions + # that have shown up since the last swapon. + # + # Ignore 255 status due to swap already being enabled + # + if [ "$NOSWAP" = yes ] + then + [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap." + else + if [ "$VERBOSE" = no ] + then + log_action_begin_msg "Activating $1 swap" + swapon -a -e 2>/dev/null || : # Stifle "Device or resource busy" + log_action_end_msg 0 + else + log_daemon_msg "Will now activate $1 swap" + swapon -a -e -v + log_action_end_msg $? + fi + fi +} diff -Nru sysvinit-2.88dsf/debian/src/initscripts/lib/init/tmpfs.sh sysvinit-2.88dsf/debian/src/initscripts/lib/init/tmpfs.sh --- sysvinit-2.88dsf/debian/src/initscripts/lib/init/tmpfs.sh 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/lib/init/tmpfs.sh 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,133 @@ +# +# Set tmpfs vars +# + + +# Get size of physical RAM in kiB +ram_size () +{ + [ -r /proc/meminfo ] && \ + grep MemTotal /proc/meminfo | \ + sed -e 's;.*[[:space:]]\([0-9][0-9]*\)[[:space:]]kB.*;\1;' || : +} + +# Get size of swap space in kiB +swap_size () +{ + [ -r /proc/meminfo ] && \ + grep SwapTotal /proc/meminfo | \ + sed -e 's;.*[[:space:]]\([0-9][0-9]*\)[[:space:]]kB.*;\1;' || : +} + +# +# Get total VM size in kiB. Prints nothing if no RAM and/or swap was +# detectable. +# +vm_size () +{ + RAM=$(ram_size) + SWAP=$(swap_size) + + RAM="${RAM:=0}" + SWAP="${SWAP:=0}" + + echo $((RAM + SWAP)) + return 0; +} + +# +# Get size of tmpfs. If the size is absolute or a percentage, return +# that unchanged. If suffixed with "%VM", return the absolute size as +# a percentage of RAM and swap combined. If no swap was available, +# return as a percentage (tmpfs will use a percentage of RAM only). +# +tmpfs_size_vm () +{ +# Handle the no-swap case here, i.e. core memory only. Also handle no +# memory either (no proc) by just returning the original value. + RET="$1" + VMTOTAL="$(vm_size)" + VMPCT="${RET%\%VM}" + if [ "$VMPCT" != "$RET" ]; then + if [ -n "$VMTOTAL" ]; then + RET=$(((VMTOTAL / 100) * VMPCT)) + RET="${RET}k" + else + RET="${VMPCT}%" + fi + fi + echo "$RET" +} + +# Free space on /tmp in kiB. +tmp_free_space () +{ + LC_ALL=C df -kP /tmp | grep -v Filesystem | sed -e 's;^[^[:space:]][^[:space:]]*[[:space:]][[:space:]]*[0-9][0-9]*[[:space:]][[:space:]]*[0-9][0-9]*[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]][[:space:]]*.*$;\1;' +} + +# Check if an emergency tmpfs is needed +need_overflow_tmp () +{ + [ "$VERBOSE" != no ] && log_action_begin_msg "Checking minimum space in /tmp" + + ROOT_FREE_SPACE=$(tmp_free_space) + [ "$VERBOSE" != no ] && log_action_end_msg 0 + if [ -n "$ROOT_FREE_SPACE" ] && [ -n "$TMP_OVERFLOW_LIMIT" ] \ + && [ $((ROOT_FREE_SPACE < TMP_OVERFLOW_LIMIT)) = "1" ]; then + return 0 + fi + return 1 +} + +# Set defaults for /etc/default/tmpfs, in case any options are +# commented out which are needed for booting. So that an empty or +# outdated file missing newer options works correctly, set the default +# values here. + +RAMLOCK=yes +# These might be overridden by /etc/default/rcS +if [ -z "$RAMSHM" ]; then RAMSHM=yes; fi +if [ -z "$RAMTMP" ]; then RAMTMP=no; fi + +TMPFS_SIZE=20%VM +TMPFS_MODE=755 + +RUN_SIZE=10% +RUN_MODE=755 + +LOCK_SIZE=5242880 # 5MiB +LOCK_MODE=1777 + +SHM_SIZE= +SHM_MODE=1777 + +TMP_SIZE= +TMP_MODE=1777 +TMP_OVERFLOW_LIMIT=1024 + +# Source conffile +if [ -f /etc/default/tmpfs ]; then + . /etc/default/tmpfs +fi + +TMPFS_SIZE="$(tmpfs_size_vm "$TMPFS_SIZE")" +RUN_SIZE="$(tmpfs_size_vm "$RUN_SIZE")" +LOCK_SIZE="$(tmpfs_size_vm "$LOCK_SIZE")" +SHM_SIZE="$(tmpfs_size_vm "$SHM_SIZE")" +TMP_SIZE="$(tmpfs_size_vm "$TMP_SIZE")" + +RUN_OPT= +[ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE" +[ "${RUN_MODE:=$TMPFS_MODE}" ] && RUN_OPT="$RUN_OPT,mode=$RUN_MODE" + +LOCK_OPT= +[ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE" +[ "${LOCK_MODE:=$TMPFS_MODE}" ] && LOCK_OPT="$LOCK_OPT,mode=$LOCK_MODE" + +SHM_OPT= +[ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE" +[ "${SHM_MODE:=$TMPFS_MODE}" ] && SHM_OPT="$SHM_OPT,mode=$SHM_MODE" + +TMP_OPT= +[ "${TMP_SIZE:=$TMPFS_SIZE}" ] && TMP_OPT=",size=$TMP_SIZE" +[ "${TMP_MODE:=$TMPFS_MODE}" ] && TMP_OPT="$TMP_OPT,mode=$TMP_MODE" diff -Nru sysvinit-2.88dsf/debian/src/initscripts/Makefile sysvinit-2.88dsf/debian/src/initscripts/Makefile --- sysvinit-2.88dsf/debian/src/initscripts/Makefile 2016-06-15 08:45:19.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/Makefile 2016-06-03 10:37:14.000000000 +0000 @@ -23,8 +23,11 @@ cp -afv etc/* $(DESTDIR)$(sysconfdir) find $(DESTDIR)$(sysconfdir) -type d -name .svn -print0 |xargs -r0 rm -r + cp -afv lib/init/* $(DESTDIR)/lib/init find $(DESTDIR)/lib -type d -name .svn -print0 |xargs -r0 rm -r chmod 755 $(DESTDIR)$(sysconfdir)/init.d/[a-z]* + chmod 755 $(DESTDIR)$(sysconfdir)/network/if-up.d/[a-z]* + chmod 644 $(DESTDIR)/lib/init/*.sh chmod 644 $(DESTDIR)$(sysconfdir)/init.d/skeleton chmod -R g-w $(DESTDIR) chown -R root:root $(DESTDIR) diff -Nru sysvinit-2.88dsf/debian/src/initscripts/man/rcS.5 sysvinit-2.88dsf/debian/src/initscripts/man/rcS.5 --- sysvinit-2.88dsf/debian/src/initscripts/man/rcS.5 2016-06-15 08:34:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/man/rcS.5 2016-06-03 09:31:02.000000000 +0000 @@ -74,9 +74,22 @@ This will tell fsck always to repair the file systems without asking for permission. +.IP \fBASYNCMOUNTNFS\fP +Set this to 'no' to disable asynchronous mounting of network drives +when the network interfaces are mounted, and instead do it only once +when the machine boots. The default is 'yes'. It is useful to +disable this on machines where the root file system is NFS, until ifup +from ifupdown works properly in such setup. + .SH NOTE The \fBEDITMOTD\fP, \fBRAMRUN\fP and \fBUTC\fP variables are no longer -used. +used. The \fBRAMLOCK\fP, \fBRAMSHM\fP and \fBRAMTMP\fP variables have +been moved to /etc/default/tmpfs; RAMSHM and RAMTMP settings in rcS +are used (if set) for backward compatibility, but will be overridden +by settings enabled in /etc/default/tmpfs. See +.BR tmpfs (5) +for further details. The settings are not automatically migrated to +/etc/default/tmpfs. Please update /etc/default/tmpfs appropriately. The UTC setting is replaced by the UTC or LOCAL setting in /etc/adjtime, and should have been migrated automatically. See .BR hwclock (5) @@ -96,3 +109,4 @@ .BR init (8), .BR inittab (5), .BR login (1), +.BR tmpfs (5). diff -Nru sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 --- sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 1970-01-01 00:00:00.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 2016-06-03 09:31:02.000000000 +0000 @@ -0,0 +1,203 @@ +.TH tmpfs 5 "18 Feb 2012" "" "Debian Administrator's Manual" +.SH NAME +tmpfs \- variables that configure tmpfs filesystems mounted during boot +.SH DESCRIPTION +The +.I /etc/default/tmpfs +file contains variable settings in POSIX format: +.IP "" .5i +VAR=VAL +.PP +Only one assignment is allowed per line. +Comments (starting with '#') are also allowed. +.PP +This file is for the configuration of tmpfs filesystems mounted in +early boot, before filesystems from /etc/fstab are mounted. This +currently includes the filesystems /run, /run/lock, /run/shm and /tmp. +/run is required to be a tmpfs on systems supporting tmpfs mounts. +/run/lock and /run/shm may be separate tmpfs mounts, useful for +enforcing separate size limits. /tmp is not required to be a tmpfs, +and is not mounted as a tmpfs by default. +.PP + +.IP /run +Previously configured using \fBRAMRUN\fP in /etc/default/rcS, /run is +now always mounted as a ram file system (tmpfs). The size of the +tmpfs can be controlled using TMPFS_SIZE and RUN_SIZE. If desired, +the defaults may also be overridden with an entry in in /etc/fstab, +for example: + +.EX +tmpfs /run tmpfs nodev,nosuid,size=10%,mode=755 0 0 +.EE + +.IP +The contents of /run will always be lost on system reboot, and it it +is no longer explicitly cleaned at boot. Packages can not expect +directories in /run to exist after boot. Packages expecting this are +buggy and need to be fixed. Note that /run was previously /var/run, +and a compatibility symlink or bind mount will be created to allow the +old path to continue to function. + +.IP /run/lock +Previously configured using \fBRAMLOCK\fP in /etc/default/rcS. +Configured using RAMLOCK, TMPFS_SIZE and LOCK_SIZE. If desired, +the defaults may also be overridden with an entry in in /etc/fstab, +for example: + +.EX +tmpfs /run/lock tmpfs nodev,noexec,nosuid,size=52428800,mode=1777 0 0 +.EE + +.IP +Note that irrespective of these settings, /run/lock will be located on +a tmpfs, either one mounted on /run/lock (if RAMLOCK=yes) or one +mounted on /run (if RAMLOCK=no), and as a result the contents of +/var/lock will always be lost on system reboot, and it it is no longer +explicitly cleaned at boot. Packages can not expect directories in +/var/lock to exist after boot. Packages expecting this are buggy and +need to be fixed. Note that /run/lock was previously /var/lock, and a +compatibility symlink or bind mount will be created to allow the old +path to continue to function. + +.IP /run/shm +Previously configured using \fBRAMSHM\fP in /etc/default/rcS. Note +that the setting in /etc/default/rcS, if present, will still be used, +but the setting in /etc/default/tmpfs will take precedence if enabled. +Configured using RAMSHM, TMPFS_SIZE and SHM_SIZE. If desired, the +defaults may also be overridden with an entry in in /etc/fstab, for +example: + +.EX +tmpfs /run/shm tmpfs nosuid,nodev,size=40%,mode=1777 0 0 +.EE + +.IP +Packages can not expect directories in /run/shm to exist after boot. +Note that /run/shm was previously /dev/shm, and a compatibility +symlink or bind mount will be created to allow the old path to +continue to function. If an fstab entry for /dev/shm exists instead +of /run/shm, then /dev/shm will continue to be used; note that this is +only needed for users of newer versions of the Oracle database, which +contain a buggy check for /dev/shm. + +.IP /tmp +Previously configured using \fBRAMTMP\fP in /etc/default/rcS. Note +that the setting in /etc/default/rcS, if present, will still be used, +but the setting in /etc/default/tmpfs will take precedence if enabled. +Configured using RAMTMP, TMPFS_SIZE and TMP_SIZE. If desired, the +defaults may also be overridden with an entry in in /etc/fstab, for +example: + +.EX +tmpfs /tmp tmpfs nodev,nosuid,size=20%,mode=1777 0 0 +.EE + +.IP +Packages can not expect directories in /tmp to exist after boot. + +.SH OPTIONS +The following variables can be set. + +.SS Enabling or disabling tmpfs mounts + +.PP +The following options enable specific mounts (with the exception of +/run) to be enabled or disabled. Note that the addition of an entry +to /etc/fstab for any of the following will enable the mount +unconditionally, overriding the setting here. + +.IP \fBRAMLOCK\fP +Mount /run/lock as a tmpfs (separately from /run). Defaults to +\fByes\fP; set to \fBno\fP to disable (/run/lock will then be part of +the /run tmpfs, if available). + +.IP \fBRAMSHM\fP +Mount /run/shm as a tmpfs (separately from /run). Defaults to +\fByes\fP; set to \fBno\fP to disable (/run/shm will then be part of +the /run tmpfs, if available). + +.IP \fBRAMTMP\fP +Mount /tmp as a tmpfs. Defaults to \fBno\fP; set to \fByes\fP to +enable (/tmp will be part of the root filesystem if disabled). /tmp +may also be configured to be a separate mount in /etc/fstab, which +will override the RAMTMP setting. + +.SS Configuring size limits for tmpfs mounts + +.PP +The following options configure size limits for tmpfs mounts. Note +that the addition of an entry to /etc/fstab will override any of the +limits specified here. +.PP +The following _SIZE variables are the maximum size (in bytes) that +tmpfs filesystems can use. The size will be rounded down to a +multiple of the page size, 4096 bytes. If no size is set, TMPFS_SIZE +will be used as the default. +.PP +More complex mount options may be used by the creation of a +suitable entry in /etc/fstab. For example: + +.EX +tmpfs /run tmpfs size=10% 0 0 +.EE + +is equivalent to + +.EX +RUN_SIZE=10% +.EE + +and will override the RUN_SIZE setting. This will allow additional +options such as nr_blocks and nr_inodes to be used, and also +adjustment of the mode, nodev, nosuid, noexec options should any +change from the defaults be necessary. + +.IP "\fBTMPFS_SIZE\fP" +Maximum size for all tmpfs filesystems if no specific size is +provided. The default is \fB20%VM\fP (20% of virtual memory, +including swap space). If no value is provided here, the kernel +default (50% RAM) will be used. Note that the "%VM" suffix may be +used in this and all the _SIZE settings below, but may not be used in +/etc/fstab (the absolute size is calculated by the init scripts). + +.IP "\fBRUN_SIZE\fP" +Maximum size of /run (was previously /var/run). The default is 10% +core memory; the size required varies widely depending upon the +demands of the software being run; this heuristic scales /run usage on +system size. Samba in particular has been seen to use at least 50MiB +in a large heavily used server. Typical usage is hundreds of KiB, +maximum is tens of MiB. + +.IP "\fBLOCK_SIZE\fP" +Maximum size of /run/lock (was previously /var/lock). Defaults to +5242880 (5 MiB). Typical usage: tens of KiB; maximum hundreds of KiB. +The default of 5 MiB should ensure the limit is never reached. + +.IP "\fBSHM_SIZE\fP" +Maximum size of /run/shm (was previously /dev/shm). No default size; +the size required varies widely depending upon the demands of the +software being run. + +.IP "\fBTMP_SIZE\fP" +Maximum size of /tmp. No default size. + +.SS Emergency overflow /tmp + +.PP +If the amount of free space on the root filesystem falls below a +certain size, a tmpfs will be mounted on /tmp (irrespective of the +RAMTMP setting, which this overrides). This is to permit logins when +there would otherwise be too little free space for this to be possible. + +.IP "\fBTMP_OVERFLOW_LIMIT\fP" +Mount a tmpfs on /tmp if the amount of free space on the root +filesystem is below the specified limit at boot time (default 1024 +KiB). + +.SH AUTHOR +Roger Leigh + +.SH SEE ALSO +.BR mount (8), +.BR rcS (5).