2007-09-19 18:50:48 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
#=== MAKEFILE HEADER ===
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_Makefile_header() { #
|
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
# This file is automatically generated by jhalfs
|
|
|
|
# DO NOT EDIT THIS FILE MANUALLY
|
|
|
|
#
|
|
|
|
# Generated on `date "+%F %X %Z"`
|
|
|
|
|
|
|
|
|
|
|
|
SHELL = /bin/bash
|
|
|
|
|
|
|
|
MOUNT_PT = $BUILDDIR
|
2007-09-27 22:41:58 +02:00
|
|
|
SCRIPT_ROOT = $SCRIPT_ROOT
|
|
|
|
CMDSDIR = $PROGNAME-commands
|
|
|
|
SRC = /sources
|
|
|
|
SRCSDIR = \$(MOUNT_PT)\$(SRC)
|
|
|
|
FILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
|
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
LUSER = $LUSER
|
|
|
|
LGROUP = $LGROUP
|
|
|
|
LHOME = $LHOME
|
|
|
|
LUSER_HOME = \$(LHOME)/\$(LUSER)
|
2007-09-27 22:41:58 +02:00
|
|
|
SU_LUSER = su - \$(LUSER) -c
|
2007-09-19 18:50:48 +02:00
|
|
|
|
|
|
|
ADD_REPORT = $REPORT
|
|
|
|
ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
|
|
|
|
ADD_BLFS_TOOLS = $BLFS_TOOL
|
|
|
|
|
|
|
|
|
|
|
|
export PATH := \${PATH}:/usr/sbin
|
|
|
|
|
|
|
|
include makefile-functions
|
|
|
|
|
|
|
|
EOF
|
|
|
|
) > $MKFILE
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
#==== TARGET HEADER ====
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_target() { # Create target
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
local i=$1
|
|
|
|
local PREV=$2
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
$i: $PREV
|
|
|
|
@\$(call echo_message, Building)
|
|
|
|
@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
2007-09-27 22:41:58 +02:00
|
|
|
#======== RUN THE SCRIPT =======
|
2007-09-19 18:50:48 +02:00
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_RunAsRoot() { # Some not-chroot scripts must be run as root..
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
local MOUNT_ENV
|
|
|
|
local file=$1
|
|
|
|
|
|
|
|
case ${PROGNAME} in
|
|
|
|
lfs ) MOUNT_ENV="LFS" ;;
|
|
|
|
clfs ) MOUNT_ENV="CLFS" ;;
|
|
|
|
clfs2 ) MOUNT_ENV="CLFS" ;;
|
|
|
|
clfs3 ) MOUNT_ENV="CLFS" ;;
|
|
|
|
hlfs ) MOUNT_ENV="HLFS" ;;
|
|
|
|
*) echo "undefined progname $PROGNAME"; exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
2007-09-27 22:41:58 +02:00
|
|
|
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \$(CMDSDIR)/`dirname $file`/\$@ > $LOGDIRBASE/\$@ 2>&1
|
2007-09-19 18:50:48 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_RunScript() { #
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
local file=$1
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
2007-09-27 21:26:14 +02:00
|
|
|
@\$(CMDSDIR)/`dirname $file`/\$@ > $LOGDIRBASE/\$@ 2>&1
|
2007-09-19 18:50:48 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
#====== COPY FSTAB =====
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
LUSER_wrt_CopyFstab() { # Needed for CLFS Sysroot and Embedded
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
2007-09-27 21:26:14 +02:00
|
|
|
@cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab > $LOGDIRBASE/\$@ 2>&1
|
2007-09-19 18:50:48 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_CopyFstab() { #
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
2007-09-27 21:26:14 +02:00
|
|
|
@cp -v /sources/fstab /etc/fstab > $LOGDIRBASE/\$@ 2>&1
|
2007-09-19 18:50:48 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
#==== INSTALLED FILES LOGS ====
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
LUSER_wrt_TouchTimestamp() { # Needed for CLFS Sysroot and Embedded
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@\$(call touch_timestamp_LUSER)
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_TouchTimestamp() { #
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@\$(call touch_timestamp)
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
LUSER_wrt_LogNewFiles() { # Needed for CLFS Sysroot and Embedded
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
local name=$1
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@\$(call log_new_files_LUSER,$name)
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2007-09-27 22:41:58 +02:00
|
|
|
wrt_LogNewFiles() { #
|
2007-09-19 18:50:48 +02:00
|
|
|
#----------------------------------#
|
|
|
|
local name=$1
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@\$(call log_new_files,$name)
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|
|
|
|
|
|
|
|
|
|
|
|
#======== TOUCH ========
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_touch() { #
|
|
|
|
#----------------------------------#
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@\$(call housekeeping)
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================
|