source: scripts_home/scripts/target-scripts/target-sysvinit.sh@ 1c9c5c3

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

r624@server (orig r622): jim | 2005-10-31 12:40:28 -0800
Rearranging Archive

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