source: scripts/native-scripts/native-sysvinit.sh@ 0ee931e

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 0ee931e was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • Property mode set to 100755
File size: 2.6 KB
Line 
1#!/bin/bash
2
3# cross-lfs native sysvinit build
4# -------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12LOG=sysvinit-native.log
13
14set_libdirname
15setup_multiarch
16
17unpack_tarball sysvinit-${SYSVINIT_VER} &&
18cd ${PKGDIR}
19
20# TODO: add some logic around this...
21# this needs to be tracked
22case ${SYSVINIT_VER} in
23 2.85 )
24 apply_patch sysvinit-2.85-proclen-1
25 ;;
26esac
27
28# From LFS CVS
29cp src/init.c src/init.c-ORIG &&
30sed 's/Sending processes/Sending processes started by init/g' \
31 src/init.c-ORIG > src/init.c
32
33# Modify Makefile
34test -f src/Makefile-ORIG ||
35 cp src/Makefile src/Makefile-ORIG
36
37# 1: Add -pipe to CFLAGS ( default optimization is -O2 )
38# 2: Also change BIN_OWNER and BIN_GROUP from "root" to 0
39# 3: Modify instructions using chown $(BIN_COMBO) to do a
40# chown $(BIN_OWNER) and a chgrp $(BIN_GROUP) instead
41# 4: makefile works with /dev/initctl, NOT $(ROOT)/dev/initctl
42# change this so it operates on our target root, NOT the hosts
43# 5: alter mknod of $(ROOT)/dev/initctl to not set mode while creating the fifo
44# instead set mode with chmod.
45
46sed -e 's@^CFLAGS.*-O2@& -pipe@g' \
47 -e 's@root@0@g' \
48 -e 's@chown $(BIN_COMBO) \(.*\)@chown $(BIN_OWNER) \1 ;chgrp $(BIN_GROUP) \1@g' \
49 -e 's@/dev/initctl@$(ROOT)&@g' \
50 -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
51 src/Makefile-ORIG > src/Makefile
52
53
54max_log_init Sysvinit ${SYSVINIT_VER} "native (shared)" ${BUILDLOGS} ${LOG}
55make -C src CC="${CC-gcc} ${ARCH_CFLAGS}" LDFLAGS="-s" \
56 >> ${LOGFILE} 2>&1 &&
57echo " o Build OK" &&
58
59mkdir -p /usr/share/man/man{1,5,8}
60
61min_log_init ${INSTLOGS} &&
62make -C src install \
63 >> ${LOGFILE} 2>&1 &&
64echo " o ALL OK" || barf
65
66# If we already have an /etc/inittab, move it out the way
67test -f /etc/inittab &&
68 mv /etc/inittab /etc/inittab-${DATE}
69
70cat > /etc/inittab << "EOF"
71# Begin /etc/inittab
72
73id:3:initdefault:
74
75si::sysinit:/etc/rc.d/init.d/rc sysinit
76
77l0:0:wait:/etc/rc.d/init.d/rc 0
78l1:S1:wait:/etc/rc.d/init.d/rc 1
79l2:2:wait:/etc/rc.d/init.d/rc 2
80l3:3:wait:/etc/rc.d/init.d/rc 3
81l4:4:wait:/etc/rc.d/init.d/rc 4
82l5:5:wait:/etc/rc.d/init.d/rc 5
83l6:6:wait:/etc/rc.d/init.d/rc 6
84
85ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
86
87su:S016:once:/sbin/sulogin
88EOF
89
90# Check if we are using DEVFS or not before creating getty entries
91# If we are using DEVFS need to specify vc/x NOT ttyx
92tty_string="tty"
93test Y = "${DEVFS}" &&
94 tty_string="vc/"
95
96for vc_no in 1 2 3 4 5 6 ; do
97 echo "${vc_no}:2345:respawn:/sbin/agetty ${tty_string}${vc_no} 9600" \
98 >> ${LFS}/etc/inittab
99done
100
101echo -e "\n# End /etc/inittab" >> ${LFS}/etc/inittab
102
Note: See TracBrowser for help on using the repository browser.