Skip to content

Commit 27260a7

Browse files
authored
Merge pull request #1 from Linux4Yourself/scripts
add bootscripts
2 parents 237ce45 + f6fbd78 commit 27260a7

33 files changed

+4584
-2
lines changed

ChangeLog

Lines changed: 1168 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
ETCDIR=${DESTDIR}/etc
2+
LIBDIR=${DESTDIR}/lib
3+
SERVICEDIR=${LIBDIR}/services
4+
MAN8=${DESTDIR}/usr/share/man/man8
5+
SBIN=${DESTDIR}/sbin
6+
MODE=754
7+
DIRMODE=755
8+
CONFMODE=644
9+
10+
all: links
11+
12+
install: all
13+
14+
create-dirs:
15+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc0.d
16+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc1.d
17+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc2.d
18+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc3.d
19+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc4.d
20+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc5.d
21+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc6.d
22+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rcS.d
23+
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/init.d
24+
install -d -m ${DIRMODE} ${ETCDIR}/sysconfig
25+
install -d -m ${DIRMODE} ${LIBDIR}
26+
install -d -m ${DIRMODE} ${SERVICEDIR}
27+
install -d -m ${DIRMODE} ${MAN8}
28+
install -d -m ${DIRMODE} ${SBIN}
29+
ln -sfn services ${LIBDIR}/lsb
30+
ln -sfn rc.d/init.d ${ETCDIR}/init.d
31+
32+
files: create-dirs
33+
install -m ${MODE} lfs/init.d/checkfs ${ETCDIR}/rc.d/init.d/
34+
install -m ${MODE} lfs/init.d/cleanfs ${ETCDIR}/rc.d/init.d/
35+
install -m ${MODE} lfs/init.d/halt ${ETCDIR}/rc.d/init.d/
36+
install -m ${MODE} lfs/init.d/console ${ETCDIR}/rc.d/init.d/
37+
install -m ${MODE} lfs/init.d/localnet ${ETCDIR}/rc.d/init.d/
38+
install -m ${MODE} lfs/init.d/modules ${ETCDIR}/rc.d/init.d/
39+
install -m ${MODE} lfs/init.d/mountfs ${ETCDIR}/rc.d/init.d/
40+
install -m ${MODE} lfs/init.d/mountvirtfs ${ETCDIR}/rc.d/init.d/
41+
install -m ${MODE} lfs/init.d/network ${ETCDIR}/rc.d/init.d/
42+
install -m ${MODE} lfs/init.d/rc ${ETCDIR}/rc.d/init.d/
43+
install -m ${MODE} lfs/init.d/reboot ${ETCDIR}/rc.d/init.d/
44+
install -m ${MODE} lfs/init.d/sendsignals ${ETCDIR}/rc.d/init.d/
45+
install -m ${MODE} lfs/init.d/setclock ${ETCDIR}/rc.d/init.d/
46+
install -m ${MODE} lfs/init.d/swap ${ETCDIR}/rc.d/init.d/
47+
install -m ${MODE} lfs/init.d/sysctl ${ETCDIR}/rc.d/init.d/
48+
install -m ${MODE} lfs/init.d/sysklogd ${ETCDIR}/rc.d/init.d/
49+
install -m ${MODE} lfs/init.d/template ${ETCDIR}/rc.d/init.d/
50+
install -m ${MODE} lfs/init.d/udev ${ETCDIR}/rc.d/init.d/
51+
install -m ${MODE} lfs/init.d/udev_retry ${ETCDIR}/rc.d/init.d/
52+
install -m ${MODE} lfs/sbin/ifup ${SBIN}
53+
install -m ${MODE} lfs/sbin/ifdown ${SBIN}
54+
install -m ${CONFMODE} lfs/sbin/ifup.8 ${MAN8}
55+
ln -sf ifup.8 ${MAN8}/ifdown.8
56+
install -m ${MODE} lfs/lib/services/ipv4-static-route ${SERVICEDIR}
57+
install -m ${MODE} lfs/lib/services/ipv4-static ${SERVICEDIR}
58+
install -m ${CONFMODE} lfs/lib/services/init-functions ${SERVICEDIR}
59+
60+
if [ ! -f ${ETCDIR}/sysconfig/createfiles ]; then \
61+
install -m ${CONFMODE} lfs/sysconfig/createfiles ${ETCDIR}/sysconfig/ ;\
62+
fi
63+
if [ ! -f ${ETCDIR}/sysconfig/modules ]; then \
64+
install -m ${CONFMODE} lfs/sysconfig/modules ${ETCDIR}/sysconfig/ ;\
65+
fi
66+
if [ ! -f ${ETCDIR}/sysconfig/udev_retry ]; then \
67+
install -m ${CONFMODE} lfs/sysconfig/udev_retry ${ETCDIR}/sysconfig/ ;\
68+
fi
69+
if [ ! -f ${ETCDIR}/sysconfig/rc.site ]; then \
70+
install -m ${CONFMODE} lfs/sysconfig/rc.site ${ETCDIR}/sysconfig/ ;\
71+
fi
72+
73+
links: rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6
74+
75+
rcS: files
76+
ln -sf ../init.d/mountvirtfs ${ETCDIR}/rc.d/rcS.d/S00mountvirtfs
77+
ln -sf ../init.d/modules ${ETCDIR}/rc.d/rcS.d/S05modules
78+
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rcS.d/S08localnet
79+
ln -sf ../init.d/udev ${ETCDIR}/rc.d/rcS.d/S10udev
80+
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rcS.d/S20swap
81+
ln -sf ../init.d/checkfs ${ETCDIR}/rc.d/rcS.d/S30checkfs
82+
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rcS.d/S40mountfs
83+
ln -sf ../init.d/cleanfs ${ETCDIR}/rc.d/rcS.d/S45cleanfs
84+
ln -sf ../init.d/udev_retry ${ETCDIR}/rc.d/rcS.d/S50udev_retry
85+
ln -sf ../init.d/console ${ETCDIR}/rc.d/rcS.d/S70console
86+
ln -sf ../init.d/sysctl ${ETCDIR}/rc.d/rcS.d/S90sysctl
87+
88+
rc0: files
89+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc0.d/K80network
90+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc0.d/K90sysklogd
91+
ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/S60sendsignals
92+
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/S65swap
93+
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/S70mountfs
94+
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/S90localnet
95+
ln -sf ../init.d/halt ${ETCDIR}/rc.d/rc0.d/S99halt
96+
97+
rc1: files
98+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc1.d/K80network
99+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc1.d/K90sysklogd
100+
101+
rc2: files
102+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc2.d/K80network
103+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc2.d/K90sysklogd
104+
105+
rc3: files
106+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc3.d/S10sysklogd
107+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc3.d/S20network
108+
109+
rc4: files
110+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc4.d/S10sysklogd
111+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc4.d/S20network
112+
113+
rc5: files
114+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc5.d/S10sysklogd
115+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc5.d/S20network
116+
117+
rc6: files
118+
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc6.d/K80network
119+
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc6.d/K90sysklogd
120+
ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc6.d/S60sendsignals
121+
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc6.d/S65swap
122+
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc6.d/S70mountfs
123+
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc6.d/S90localnet
124+
ln -sf ../init.d/reboot ${ETCDIR}/rc.d/rc6.d/S99reboot
125+
126+
uninstall:
127+
rm -rf ${DESTDIR}/lib/services ${DESTDIR}/lib/lsb ${ETCDIR}/rc.d ${ETCDIR}/init.d \
128+
${SBIN}/ifup ${SBIN}/ifdown ${MAN8}/ifup.8 ${MAN8}/ifdown.8 \
129+
${ETCDIR}/sysconfig/rc
130+
131+
.PHONY: all create-dirs install files links rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6 uninstall
132+

README

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
This is fork of LFS-Bootscripts
2+
3+
Network Configuration:
4+
Script Files:
5+
/etc/rc.d/init.d/*
6+
/sbin/ifup
7+
/sbin/ifdown
8+
/lib/lsb/*
9+
10+
Configuration Files:
11+
/etc/sysconfig/ifconfig.*
12+
Note: ifconfig.* files will be processed
13+
in alphanumerical order on boot, and reversed on shutdown.
14+
- IFACE : The interface that is being configured (e.g. eth0)
15+
- SERVICE: Which script to run in services directory.
16+
- ONBOOT : If set to yes, this interface will be started on bootup
17+
18+
/etc/sysconfig/network
19+
- HOSTNAME: Value of the system's hostname (From LFS Book)
20+
This value may also be set in /etc/sysconfig/rc.site
21+
22+
Additional Configuration:
23+
SERVICE ipv4-static:
24+
- IP : Static IP Address
25+
- GATEWAY : Specifies the IP Address of the gateway server
26+
- PREFIX : CIDR prefix of IP Address, defaults to 24 if not set
27+
- PEER : IP Address of peer (for point-to-point connections and tunnels)
28+
- BROADCAST: Broadcast address
29+
30+
SERVICE ipv4-static-route:
31+
- TYPE : network (default type if not specified), default, host or unreachable
32+
- IP : IP Address of target (for network, host and unreachable)
33+
- PREFIX : CIDR prefix of target (for network, host and unreachable)
34+
- GATEWAY: IP Address of gateway to reach target (for network and default)
35+
36+
37+
SetClock configuration:
38+
39+
Configuration Files:
40+
/etc/sysconfig/clock or /etc/sysconfig/rc.site
41+
- UTC: 1 assumes hwclock is in UTC
42+
0 assumes hwclock is in local time
43+
- CLOCKPARAMS: any additional options to be passed to hwclock
44+
45+
CleanFS configuration:
46+
Script Files:
47+
/etc/rc.d/init.d/cleanfs
48+
49+
Configuration Files:
50+
/etc/sysconfig/rc.site
51+
- SKIPTMPCLEAN: skips cleaning of /tmp directory
52+
53+
/etc/sysconfig/createfiles
54+
Each line is parsed, using space as a deliminator.
55+
[NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
56+
The below fields are currently only used on dev type.
57+
([DEV TYPE] [MAJOR#] [MINOR#])
58+
Name:
59+
File/Directory/Device name
60+
Type:
61+
dir: creates a directory
62+
file: creates a file
63+
dev: creates a device
64+
Permissions:
65+
chmod the created file
66+
User/Group:
67+
chown the created file/dir to this user/group
68+
Dev Type:
69+
char: character [needs MAJOR#, MINOR#]
70+
block: block [needs MAJOR#, MINOR#]
71+
pipe: pipe
72+
Major#:
73+
Used by character and block devices.
74+
Minor#:
75+
Used by character and block devices.
76+

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

lfs/init.d/checkfs

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/bin/sh
2+
########################################################################
3+
# Begin checkfs
4+
#
5+
# Description : File System Check
6+
#
7+
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8+
# A. Luebke - luebke@users.sourceforge.net
9+
# DJ Lucas - dj@linuxfromscratch.org
10+
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
11+
#
12+
# Version : LFS 7.0
13+
#
14+
# Based on checkfs script from LFS-3.1 and earlier.
15+
#
16+
# From man fsck
17+
# 0 - No errors
18+
# 1 - File system errors corrected
19+
# 2 - System should be rebooted
20+
# 4 - File system errors left uncorrected
21+
# 8 - Operational error
22+
# 16 - Usage or syntax error
23+
# 32 - Fsck canceled by user request
24+
# 128 - Shared library error
25+
#
26+
#########################################################################
27+
28+
### BEGIN INIT INFO
29+
# Provides: checkfs
30+
# Required-Start: udev swap
31+
# Should-Start:
32+
# Required-Stop:
33+
# Should-Stop:
34+
# Default-Start: S
35+
# Default-Stop:
36+
# Short-Description: Checks local filesystems before mounting.
37+
# Description: Checks local filesystmes before mounting.
38+
# X-LFS-Provided-By: LFS
39+
### END INIT INFO
40+
41+
. /lib/lsb/init-functions
42+
43+
case "${1}" in
44+
start)
45+
if [ -f /fastboot ]; then
46+
msg="/fastboot found, will omit "
47+
msg="${msg} file system checks as requested.\n"
48+
log_info_msg "${msg}"
49+
exit 0
50+
fi
51+
52+
log_info_msg "Mounting root file system in read-only mode... "
53+
mount -n -o remount,ro / >/dev/null
54+
55+
if [ ${?} != 0 ]; then
56+
log_failure_msg2
57+
msg="\n\nCannot check root "
58+
msg="${msg}filesystem because it could not be mounted "
59+
msg="${msg}in read-only mode.\n\n"
60+
msg="${msg}After you press Enter, this system will be "
61+
msg="${msg}halted and powered off.\n\n"
62+
log_failure_msg "${msg}"
63+
64+
log_info_msg "Press Enter to continue..."
65+
wait_for_user
66+
/etc/rc.d/init.d/halt stop
67+
else
68+
log_success_msg2
69+
fi
70+
71+
if [ -f /forcefsck ]; then
72+
msg="/forcefsck found, forcing file"
73+
msg="${msg} system checks as requested."
74+
log_success_msg "$msg"
75+
options="-f"
76+
else
77+
options=""
78+
fi
79+
80+
log_info_msg "Checking file systems..."
81+
# Note: -a option used to be -p; but this fails e.g. on fsck.minix
82+
if is_true "$VERBOSE_FSCK"; then
83+
fsck ${options} -a -A -C -T
84+
else
85+
fsck ${options} -a -A -C -T >/dev/null
86+
fi
87+
88+
error_value=${?}
89+
90+
if [ "${error_value}" = 0 ]; then
91+
log_success_msg2
92+
fi
93+
94+
if [ "${error_value}" = 1 ]; then
95+
msg="\nWARNING:\n\nFile system errors "
96+
msg="${msg}were found and have been corrected.\n"
97+
msg="${msg} You may want to double-check that "
98+
msg="${msg}everything was fixed properly."
99+
log_warning_msg "$msg"
100+
fi
101+
102+
if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
103+
msg="\nWARNING:\n\nFile system errors "
104+
msg="${msg}were found and have been been "
105+
msg="${msg}corrected, but the nature of the "
106+
msg="${msg}errors require this system to be rebooted.\n\n"
107+
msg="${msg}After you press enter, "
108+
msg="${msg}this system will be rebooted\n\n"
109+
log_failure_msg "$msg"
110+
111+
log_info_msg "Press Enter to continue..."
112+
wait_for_user
113+
reboot -f
114+
fi
115+
116+
if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
117+
msg="\nFAILURE:\n\nFile system errors "
118+
msg="${msg}were encountered that could not be "
119+
msg="${msg}fixed automatically.\nThis system "
120+
msg="${msg}cannot continue to boot and will "
121+
msg="${msg}therefore be halted until those "
122+
msg="${msg}errors are fixed manually by a "
123+
msg="${msg}System Administrator.\n\n"
124+
msg="${msg}After you press Enter, this system will be "
125+
msg="${msg}halted and powered off.\n\n"
126+
log_failure_msg "$msg"
127+
128+
log_info_msg "Press Enter to continue..."
129+
wait_for_user
130+
/etc/rc.d/init.d/halt stop
131+
fi
132+
133+
if [ "${error_value}" -ge 16 ]; then
134+
msg="FAILURE:\n\nUnexpected failure "
135+
msg="${msg}running fsck. Exited with error "
136+
msg="${msg} code: ${error_value}.\n"
137+
log_info_msg $msg
138+
exit ${error_value}
139+
fi
140+
141+
exit 0
142+
;;
143+
*)
144+
echo "Usage: ${0} {start}"
145+
exit 1
146+
;;
147+
esac
148+
149+
# End checkfs

0 commit comments

Comments
 (0)