Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7de71fa1cd | ||
|
|
97906ebe04 | ||
|
|
8d4cb9e335 | ||
|
|
aa612e0add | ||
|
|
008c9f186a |
9
Makefile
9
Makefile
@@ -8,16 +8,17 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
DEPENDS = bash,iftools,kmod,procps-ng,sysvinit
|
||||
DEPENDS = dash,kmod,procps-ng,sysvinit
|
||||
ARCH = x86_64
|
||||
URL =
|
||||
URL = http://snaplinux.org
|
||||
REPO = core
|
||||
BRIEF = Base scripts for sysvinit
|
||||
DESC = This package supplies the base system init scripts for sysvinit
|
||||
DESC = This package supplies the core required init scripts for startup
|
||||
|
||||
ARCHIVE := ''
|
||||
SRCDIR := $(PWD)/SRC/initscripts
|
||||
PATCHDIR := $(PWD)/SRC/patches
|
||||
VERSION := 1.2-0
|
||||
VERSION := 1.8-0
|
||||
|
||||
include /usr/share/snap/Makefile.snaplinux
|
||||
|
||||
|
||||
23
SNAP/usher
23
SNAP/usher
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -7,25 +7,22 @@ case $1 in
|
||||
exit 0
|
||||
;;
|
||||
postinst)
|
||||
if [[ ${TARGET} ]]; then
|
||||
chroot ${TARGET} update-rc required
|
||||
else
|
||||
update-rc required
|
||||
|
||||
if [ ! -f /etc/fstab ]; then
|
||||
cp /usr/share/initscripts/fstab /etc/fstab
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/modules.conf ]; then
|
||||
cp ${TARGET}/usr/share/initscripts/modules.conf \
|
||||
${TARGET}/etc/modules.conf
|
||||
if [ ! -f /etc/modules.conf ]; then
|
||||
cp /usr/share/initscripts/modules.conf /etc/modules.conf
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/default/halt ]; then
|
||||
cp ${TARGET}/usr/share/initscripts/halt.default \
|
||||
${TARGET}/etc/default/halt
|
||||
if [ ! -f /etc/default/halt ]; then
|
||||
cp /usr/share/initscripts/halt.default /etc/default/halt
|
||||
fi
|
||||
|
||||
if [ ! -f ${TARGET}/etc/default/rcS ]; then
|
||||
cp ${TARGET}/usr/share/initscripts/rcS.default \
|
||||
${TARGET}/etc/default/rcS
|
||||
if [ ! -f /etc/default/rcS ]; then
|
||||
cp /usr/share/initscripts/rcS.default /etc/default/rcS
|
||||
fi
|
||||
;;
|
||||
prerm)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
dirs:
|
||||
install -d -m 755 $(DESTDIR)/etc/default
|
||||
install -d -m 755 $(DESTDIR)/etc/{rc{{0..6},S},init}.d
|
||||
install -d -m 755 $(DESTDIR)/etc/init.d
|
||||
install -d -m 755 $(DESTDIR)/lib/lsb
|
||||
install -d -m 755 $(DESTDIR)/usr/share/initscripts
|
||||
install -d -m 755 $(DESTDIR)/usr/share/man/man8
|
||||
install -d -m 755 $(DESTDIR)/sbin
|
||||
install -d -m 755 $(DESTDIR)/usr/sbin
|
||||
|
||||
files:
|
||||
install -m 755 init.d/checkfs $(DESTDIR)/etc/init.d/checkfs
|
||||
@@ -12,7 +12,6 @@ files:
|
||||
install -m 755 init.d/halt $(DESTDIR)/etc/init.d/halt
|
||||
install -m 755 init.d/hostname $(DESTDIR)/etc/init.d/hostname
|
||||
install -m 755 init.d/hwclock $(DESTDIR)/etc/init.d/hwclock
|
||||
install -m 755 init.d/localnet $(DESTDIR)/etc/init.d/localnet
|
||||
install -m 755 init.d/modules $(DESTDIR)/etc/init.d/modules
|
||||
install -m 755 init.d/mountfs $(DESTDIR)/etc/init.d/mountfs
|
||||
install -m 755 init.d/mountvirtfs $(DESTDIR)/etc/init.d/mountvirtfs
|
||||
@@ -22,12 +21,15 @@ files:
|
||||
install -m 755 init.d/swap $(DESTDIR)/etc/init.d/swap
|
||||
install -m 755 init.d/sysctl $(DESTDIR)/etc/init.d/sysctl
|
||||
install -m 755 init-functions $(DESTDIR)/lib/lsb/init-functions
|
||||
install -m 644 fstab \
|
||||
$(DESTDIR)/usr/share/initscripts/fstab
|
||||
install -m 644 halt.default \
|
||||
$(DESTDIR)/usr/share/initscripts/halt.default
|
||||
install -m 644 modules.conf \
|
||||
$(DESTDIR)/usr/share/initscripts/modules.conf
|
||||
install -m 644 rcS.default \
|
||||
$(DESTDIR)/usr/share/initscripts/rcS.default
|
||||
install -m 755 update-rc $(DESTDIR)/sbin
|
||||
install -m 755 update-rc $(DESTDIR)/usr/sbin
|
||||
install -m 755 service $(DESTDIR)/usr/sbin
|
||||
|
||||
install: dirs files
|
||||
|
||||
4
SRC/initscripts/fstab
Normal file
4
SRC/initscripts/fstab
Normal file
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# /etc/fstab - file system mount definitions
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <fsck>
|
||||
@@ -1,4 +1,18 @@
|
||||
#!/bin/sh
|
||||
# /lib/lsb/init-functions - shell functions and variables for init scripts
|
||||
|
||||
#
|
||||
# This sets some environment variables that init scripts can use
|
||||
# to determine if we're running in a container
|
||||
#
|
||||
# Most likely just checking for the presence of $container would
|
||||
# be enough
|
||||
#
|
||||
|
||||
if [ -r /proc/1/environ ]; then
|
||||
chkcontainer=$(sed 's/\x0/\n/g' < /proc/1/environ|grep -ia '^container\|^LXC')
|
||||
fi
|
||||
|
||||
[ -n "$chkcontainer" ] && export $chkcontainer
|
||||
|
||||
COL52="\\033[52G"
|
||||
|
||||
@@ -54,19 +68,19 @@ log_init_msg() {
|
||||
}
|
||||
|
||||
log_failure_msg() {
|
||||
echo -e "$COL52[ FAIL ]"
|
||||
echo "$COL52[ FAIL ]"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log_success_msg() {
|
||||
echo -e "$COL52[ OK ]"
|
||||
echo "$COL52[ OK ]"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log_warning_msg() {
|
||||
echo -e "$COL52[ WARN ]"
|
||||
echo "$COL52[ WARN ]"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
[ -z $container ] || exit 0
|
||||
[ -z "$VERBOSE" ] && VERBOSE=no
|
||||
[ -z "$FSCKFIX" ] && FSCKFIX=no
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
@@ -70,7 +73,7 @@ case "$1" in
|
||||
case "$VERBOSE" in
|
||||
1|y|yes)
|
||||
echo
|
||||
if [ $status == 0 ]; then
|
||||
if [ "$status" = 0 ]; then
|
||||
exit 0
|
||||
else
|
||||
log_init_msg "Filesystem issues detected"
|
||||
@@ -78,15 +81,15 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $status == 0 ]; then
|
||||
if [ "$status" = 0 ]; then
|
||||
log_success_msg
|
||||
elif [ $status != 1 ]; then
|
||||
elif [ "$status" = 1 ]; then
|
||||
log_warning_msg
|
||||
|
||||
echo
|
||||
echo "WARNING: File system errors were detected and repaired."
|
||||
echo
|
||||
elif [ $status == 2 -o $status == 3 ]; then
|
||||
elif [ "$status" = 2 -o "$status" = 3 ]; then
|
||||
log_warning_msg
|
||||
|
||||
echo
|
||||
@@ -96,7 +99,7 @@ case "$1" in
|
||||
echo "Press enter to reboot"
|
||||
read
|
||||
reboot -f
|
||||
elif [ $status -gt 3 -a $status -lt 16 ]; then
|
||||
elif [ "$status" -gt 3 -a "$status" -lt 16 ]; then
|
||||
log_failure_msg
|
||||
|
||||
echo
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
[ -z "$CLEANDIRS" ] && exit 0
|
||||
[ -z $container ] || exit 0
|
||||
|
||||
clean() {
|
||||
[ -d $1 ] || return 1
|
||||
|
||||
@@ -19,11 +19,11 @@ case "$1" in
|
||||
poweroff='-p'
|
||||
netdown='-i'
|
||||
|
||||
if [ "$HALT" == "halt" ]; then
|
||||
if [ "$HALT" = "halt" ]; then
|
||||
poweroff=''
|
||||
fi
|
||||
|
||||
if [ "$NETDOWN" == "no" ]; then
|
||||
if [ "$NETDOWN" = "no" ]; then
|
||||
netdown=''
|
||||
fi
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
[ -r /etc/default/rcS ] && . /etc/default/rcS
|
||||
[ -z $container ] || exit 0
|
||||
|
||||
case "$UTC" in
|
||||
0|n|no)
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: localnet
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Should-Start: $syslog
|
||||
# Should-Stop: $syslog
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Start and configure loopback interface
|
||||
# X-Required: true
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_init_msg "Bringing up loopback interface"
|
||||
ifup lo && log_success_msg || log_failure_msg
|
||||
;;
|
||||
stop)
|
||||
log_init_msg "Bringing down loopback interface"
|
||||
ifdown lo && log_success_msg || log_failure_msg
|
||||
;;
|
||||
|
||||
reload|restart)
|
||||
log_init_msg "Restarting loopback interface"
|
||||
ifreload lo && log_success_msg || log_failure_msg
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 [start|stop|reload|restart]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -15,6 +15,7 @@ CONF=/etc/modules.conf
|
||||
|
||||
[ -r $CONF ] || exit 0
|
||||
[ -e /proc/modules ] || exit 0
|
||||
[ -z $container ] || exit 0
|
||||
egrep -qv '^(\s*#|$)' $CONF || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
@@ -9,14 +9,16 @@
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Mounts/unmounts local filesystems
|
||||
# Description: Remounts root filesystem read/write and mounts all
|
||||
# remaining local filesystems defined in /etc/fstab or
|
||||
# in ZFS. Remounts root filesystem read-only and unmounts
|
||||
# remaining local filesystems defined in /etc/fstab.
|
||||
# Remounts root filesystem read-only and unmounts
|
||||
# remaining filesystems on stop.
|
||||
# X-Required: true
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
[ -z $container ] || exit 0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_init_msg "Remounting root file system in read-write mode"
|
||||
@@ -32,13 +34,6 @@ case "$1" in
|
||||
rm /forcefsck && log_success_msg || log_failure_msg
|
||||
fi
|
||||
|
||||
if [ -x /sbin/zpool ]; then
|
||||
if zpool list rpool 2>&1 > /dev/null; then
|
||||
log_init_msg "Mounting ZFS file systems"
|
||||
zfs mount -a && log_success_msg || log_failure_msg
|
||||
fi
|
||||
fi
|
||||
|
||||
log_init_msg "Mounting remaining file systems"
|
||||
mount -a -O no_netdev >/dev/null && log_success_msg || log_failure_msg
|
||||
;;
|
||||
@@ -47,13 +42,6 @@ case "$1" in
|
||||
umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts \
|
||||
>/dev/null && log_success_msg || log_failure_msg
|
||||
|
||||
if [ -x /sbin/zpool ]; then
|
||||
if zpool list rpool 2>&1 > /dev/null; then
|
||||
log_init_msg "Unmounting ZFS file systems"
|
||||
zfs umount -a && log_success_msg || log_failure_msg
|
||||
fi
|
||||
fi
|
||||
|
||||
mount -o remount,ro /
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -80,14 +80,6 @@ mountrun () {
|
||||
/run || return 1
|
||||
fi
|
||||
|
||||
mkdir -p /run/lock /run/shm || return 1
|
||||
chmod 1777 /run/shm || return 1
|
||||
|
||||
if grep -q '^utmp:' /etc/group; then
|
||||
chmod 664 /run/utmp >> /run/utmp
|
||||
chgrp utmp /run/utmp
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -105,12 +97,21 @@ case "$1" in
|
||||
start|restart)
|
||||
log_init_msg "Mounting virtual file systems"
|
||||
|
||||
if [ -z $container ]; then
|
||||
for dir in dev pts proc run sys; do
|
||||
mount$dir || error=1
|
||||
done
|
||||
fi
|
||||
|
||||
mkdir -p /run/lock /run/shm || error=1
|
||||
chmod 1777 /run/shm || error=1
|
||||
ln -sfn /run/shm /dev/shm
|
||||
|
||||
if grep -q '^utmp:' /etc/group; then
|
||||
chmod 664 /run/utmp >> /run/utmp
|
||||
chgrp utmp /run/utmp
|
||||
fi
|
||||
|
||||
[ -z $error ] && log_success_msg || log_failure_msg
|
||||
;;
|
||||
status)
|
||||
|
||||
@@ -22,11 +22,11 @@ print_snap() {
|
||||
|
||||
case "$1" in
|
||||
S|1|2|3|4|5|6|0)
|
||||
if [ "$RUNLEVEL" == "S" ]; then
|
||||
if [ "$RUNLEVEL" = "S" ]; then
|
||||
set -a
|
||||
[ -r /etc/default/rcS ] && . /etc/default/rcS
|
||||
set +a
|
||||
dmesg -n "${LOGLEVEL:-7}"
|
||||
[ -z $container ] && dmesg -n "${LOGLEVEL:-7}"
|
||||
print_snap
|
||||
fi
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ case "$1" in
|
||||
log_init_msg "Sending all processes the KILL signal"
|
||||
killall5 -9
|
||||
|
||||
if [ "$?" == 0 -o "$?" == 2 ]; then
|
||||
if [ "$?" = 0 -o "$?" = 2 ]; then
|
||||
success=1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
[ -r /etc/fstab ] || exit 0
|
||||
[ -z $container ] || exit 0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
CONF=/etc/sysctl.conf
|
||||
[ -r $CONF ] || exit 0
|
||||
[ -z $container ] || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user