source: common/libs/func_wrt_Makefile@ f9bfa72

experimental
Last change on this file since f9bfa72 was f9bfa72, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Removed a now unused envar.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5#=== MAKEFILE HEADER ===
6
7#----------------------------------#
8wrt_Makefile_header() { #
9#----------------------------------#
10(
11 cat << EOF
12# This file is automatically generated by jhalfs
13# DO NOT EDIT THIS FILE MANUALLY
14#
15# Generated on `date "+%F %X %Z"`
16
17
18SHELL = /bin/bash
19
20SRC = /sources
21MOUNT_PT = $BUILDDIR
22LUSER = $LUSER
23LGROUP = $LGROUP
24LHOME = $LHOME
25SCRIPT_ROOT = $SCRIPT_ROOT
26
27BASEDIR = \$(MOUNT_PT)
28SRCSDIR = \$(BASEDIR)/sources
29CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
30LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
31TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
32
33crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
34crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
35crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
36crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
37
38SU_LUSER = su - \$(LUSER) -c
39LUSER_HOME = \$(LHOME)/\$(LUSER)
40
41ADD_REPORT = $REPORT
42ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
43ADD_BLFS_TOOLS = $BLFS_TOOL
44
45
46export PATH := \${PATH}:/usr/sbin
47
48include makefile-functions
49
50EOF
51) > $MKFILE
52}
53
54#=======================
55
56
57#==== TARGET HEADER ====
58
59#----------------------------------#
60LUSER_wrt_target() { # Create target
61#----------------------------------#
62 local i=$1
63 local PREV=$2
64(
65cat << EOF
66
67$i: $PREV
68 @\$(call echo_message, Building)
69 @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
70EOF
71) >> $MKFILE.tmp
72}
73
74#----------------------------------#
75CHROOT_wrt_target() { #
76#----------------------------------#
77 local i=$1
78 local PREV=$2
79(
80cat << EOF
81
82$i: $PREV
83 @\$(call echo_message, Building)
84 @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
85EOF
86) >> $MKFILE.tmp
87}
88
89#=======================
90
91
92#======== RUN AS =======
93
94#----------------------------------#
95wrt_RunAsRoot() { # Some scripts must be run as root..
96#----------------------------------#
97 local MOUNT_ENV
98 local file=$1
99
100 case ${PROGNAME} in
101 lfs ) MOUNT_ENV="LFS" ;;
102 clfs ) MOUNT_ENV="CLFS" ;;
103 clfs2 ) MOUNT_ENV="CLFS" ;;
104 clfs3 ) MOUNT_ENV="CLFS" ;;
105 hlfs ) MOUNT_ENV="HLFS" ;;
106 *) echo "undefined progname $PROGNAME"; exit 1 ;;
107 esac
108
109(
110cat << EOF
111 @export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ > logs/\$@ 2>&1
112EOF
113) >> $MKFILE.tmp
114}
115
116#----------------------------------#
117LUSER_wrt_RunAsUser() { #
118#----------------------------------#
119 local file=$1
120
121(
122cat << EOF
123 @\$(CMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
124EOF
125) >> $MKFILE.tmp
126}
127
128#----------------------------------#
129CHROOT_wrt_RunAsRoot() { #
130#----------------------------------#
131 local file=$1
132(
133cat << EOF
134 @\$(crCMDSDIR)/`dirname $file`/\$@ > logs/\$@ 2>&1
135EOF
136) >> $MKFILE.tmp
137
138}
139
140#=======================
141
142
143#====== COPY FSTAB =====
144
145#----------------------------------#
146LUSER_wrt_CopyFstab() { #
147#----------------------------------#
148(
149cat << EOF
150 @cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab > logs/\$@ 2>&1
151EOF
152) >> $MKFILE.tmp
153}
154
155#----------------------------------#
156CHROOT_wrt_CopyFstab() { #
157#----------------------------------#
158(
159cat << EOF
160 @cp -v /sources/fstab /etc/fstab > logs/\$@ 2>&1
161EOF
162) >> $MKFILE.tmp
163}
164
165#=======================
166
167
168#==== INSTALLED FILES LOGS ====
169
170#----------------------------------#
171LUSER_wrt_TouchTimestamp() { #
172#----------------------------------#
173(
174cat << EOF
175 @\$(call touch_timestamp_LUSER)
176EOF
177) >> $MKFILE.tmp
178}
179
180#----------------------------------#
181CHROOT_wrt_TouchTimestamp() { #
182#----------------------------------#
183(
184cat << EOF
185 @\$(call touch_timestamp)
186EOF
187) >> $MKFILE.tmp
188}
189
190#----------------------------------#
191LUSER_wrt_LogNewFiles() { #
192#----------------------------------#
193 local name=$1
194(
195cat << EOF
196 @\$(call log_new_files_LUSER,$name)
197EOF
198) >> $MKFILE.tmp
199}
200
201#----------------------------------#
202CHROOT_wrt_LogNewFiles() { #
203#----------------------------------#
204 local name=$1
205(
206cat << EOF
207 @\$(call log_new_files,$name)
208EOF
209) >> $MKFILE.tmp
210}
211
212#=======================
213
214
215#======== TOUCH ========
216
217#----------------------------------#
218wrt_touch() { #
219#----------------------------------#
220(
221cat << EOF
222 @\$(call housekeeping)
223EOF
224) >> $MKFILE.tmp
225}
226
227#=======================
Note: See TracBrowser for help on using the repository browser.