Implement suggestion made byDan Nicholson for configurable user/group. Required many changes and allowed for the removal of user specific function calls. Tnx Dan
This commit is contained in:
parent
725ae5a469
commit
9485eba95e
13 changed files with 307 additions and 323 deletions
|
@ -6,6 +6,10 @@
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
#--- Which target architecture you want to build for,
|
#--- Which target architecture you want to build for,
|
||||||
# used to select proper book and set TARGETS
|
# used to select proper book and set TARGETS
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
|
@ -38,6 +42,10 @@ TARGET=
|
||||||
# NOTE: not all combinations are 'bootable' yet.
|
# NOTE: not all combinations are 'bootable' yet.
|
||||||
METHOD=chroot
|
METHOD=chroot
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
116
CLFS/master.sh
116
CLFS/master.sh
|
@ -41,43 +41,43 @@ cat << EOF
|
||||||
|
|
||||||
025-addinguser: 024-creatingcrossdir
|
025-addinguser: 024-creatingcrossdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/clfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd clfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-clfs-exist; \\
|
touch user-clfs-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs \$(MOUNT_PT) && \\
|
@chown \$(LUSER) \$(MOUNT_PT) && \\
|
||||||
chown clfs \$(MOUNT_PT)/tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/cross-tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/sources && \\
|
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
026-settingenvironment: 025-addinguser
|
026-settingenvironment: 025-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/clfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/clfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
|
echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
|
echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
|
echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||||
@chown clfs:clfs /home/clfs/.bashrc && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -131,9 +131,9 @@ cross_tools_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
||||||
#
|
#
|
||||||
wrt_run_as_clfs_su "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -190,10 +190,10 @@ temptools_Makefiles() { #
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
||||||
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
#
|
#
|
||||||
wrt_run_as_clfs_su "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -262,20 +262,20 @@ boot_Makefiles() { #
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
# Insert instructions for unpacking the package and changing directories
|
# Insert instructions for unpacking the package and changing directories
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
||||||
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*changingowner*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*changingowner*) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*devices*) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*devices*) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*fstab*) if [[ -n "$FSTAB" ]]; then
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
wrt_copy_fstab "${this_script}"
|
||||||
else
|
else
|
||||||
wrt_run_as_clfs_su "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
|
*) wrt_RunAsUser "${this_script}" "${file}" ;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
# Housekeeping...remove any build directory(ies) except if the package build fails.
|
||||||
|
@ -332,7 +332,7 @@ chroot_Makefiles() { #
|
||||||
#
|
#
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*util-linux) wrt_unpack_clfs "$pkg_tarball" ;;
|
*util-linux) wrt_unpack "$pkg_tarball" ;;
|
||||||
*) wrt_unpack2 "$pkg_tarball" ;;
|
*) wrt_unpack2 "$pkg_tarball" ;;
|
||||||
esac
|
esac
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
|
@ -340,8 +340,8 @@ chroot_Makefiles() { #
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*kernfs) wrt_run_as_clfs_root "${this_script}" "${file}" ;;
|
*kernfs) wrt_RunAsRoot "${this_script}" "${file}" ;;
|
||||||
*util-linux) wrt_run_as_clfs_su "${this_script}" "${file}" ;;
|
*util-linux) wrt_RunAsUser "${this_script}" "${file}" ;;
|
||||||
*) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
*) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
|
@ -757,7 +757,7 @@ bm_bootscripts_Makefiles() { #
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
|
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*udev*) continue ;; # This is not a script but a commentary
|
*udev) continue ;; # This is not a script but a commentary
|
||||||
*console*) continue ;; # Use the files that came with the bootscripts
|
*console*) continue ;; # Use the files that came with the bootscripts
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
@ -773,8 +773,8 @@ bm_bootscripts_Makefiles() { #
|
||||||
-e 's@64@@' \
|
-e 's@64@@' \
|
||||||
-e 's@n32@@'`
|
-e 's@n32@@'`
|
||||||
case $name in
|
case $name in
|
||||||
*bootscripts*) name=bootscripts-cross-lfs
|
*bootscripts*) name=bootscripts-cross-lfs ;;
|
||||||
;;
|
*udev-rules) name=udev-cross-lfs ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
|
@ -1012,6 +1012,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -1064,8 +1066,8 @@ restart:
|
||||||
|
|
||||||
clean-chapter2:
|
clean-chapter2:
|
||||||
-if [ ! -f user-clfs-exist ]; then \\
|
-if [ ! -f user-clfs-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
|
@ -1092,13 +1094,13 @@ clean-chapter4:
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-clfs-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -1110,8 +1112,8 @@ do-housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/sys
|
@-umount \$(MOUNT_PT)/sys
|
||||||
@-umount \$(MOUNT_PT)/proc
|
@-umount \$(MOUNT_PT)/proc
|
||||||
@-if [ ! -f user-clfs-exist ]; then \\
|
@-if [ ! -f user-clfs-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1146,8 +1148,8 @@ restart:
|
||||||
|
|
||||||
clean-jhalfs:
|
clean-jhalfs:
|
||||||
-if [ ! -f user-clfs-exist ]; then \\
|
-if [ ! -f user-clfs-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
|
@ -1177,13 +1179,13 @@ clean-makesys:
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-clfs-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -fv /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv -v /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
|
|
||||||
#--- Which target architecture you want to build for,
|
#--- Which target architecture you want to build for,
|
||||||
# used to select proper book and set TARGETS
|
# used to select proper book and set TARGETS
|
||||||
|
@ -21,6 +25,10 @@ TARGET32=
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
# >>>> MULTILIB 32/64 <<<<
|
# >>>> MULTILIB 32/64 <<<<
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=clfs
|
||||||
|
LGROUP=clfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
124
CLFS2/master.sh
124
CLFS2/master.sh
|
@ -5,41 +5,6 @@
|
||||||
### FUNCTIONS ###
|
### FUNCTIONS ###
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $2
|
|
||||||
#----------------------------------#
|
|
||||||
local this_user=$1
|
|
||||||
local this_script=$2
|
|
||||||
local file=$3
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var
|
|
||||||
#----------------------------------#
|
|
||||||
local USER_ACCT=$1
|
|
||||||
local FILE=$2
|
|
||||||
local optSAVE_PREVIOUS=$3
|
|
||||||
|
|
||||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
|
||||||
wrt_remove_existing_dirs "$FILE"
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@\$(call unpack,$FILE)
|
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
|
||||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
|
||||||
chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
host_prep_Makefiles() { # Initialization of the system
|
host_prep_Makefiles() { # Initialization of the system
|
||||||
|
@ -67,42 +32,42 @@ cat << EOF
|
||||||
|
|
||||||
025-addinguser: 023-creatingtoolsdir
|
025-addinguser: 023-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/clfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd clfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-clfs-exist; \\
|
touch user-clfs-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs \$(MOUNT_PT) && \\
|
@chown \$(LUSER) \$(MOUNT_PT) && \\
|
||||||
chown clfs \$(MOUNT_PT)/tools && \\
|
chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown clfs \$(MOUNT_PT)/sources
|
chown \$(LUSER) \$(MOUNT_PT)/sources
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
026-settingenvironment: 025-addinguser
|
026-settingenvironment: 025-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/clfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/clfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\
|
echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\
|
echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\
|
echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\
|
echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/clfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\
|
echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
||||||
@chown clfs:clfs /home/clfs/.bashrc && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars
|
touch envars
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -153,7 +118,7 @@ cat << EOF
|
||||||
|
|
||||||
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
@touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
||||||
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
@chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
||||||
@chown -R clfs \$(MOUNT_PT)
|
@chown -R \$(LUSER) \$(MOUNT_PT)
|
||||||
|
|
||||||
@touch \$@ && \\
|
@touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -199,7 +164,6 @@ cross_tools_Makefiles() { #
|
||||||
glibc-headers) name="glibc" ;;
|
glibc-headers) name="glibc" ;;
|
||||||
esac
|
esac
|
||||||
pkg_tarball=$(get_package_tarball_name $name)
|
pkg_tarball=$(get_package_tarball_name $name)
|
||||||
|
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
|
@ -210,12 +174,12 @@ cross_tools_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -308,12 +272,12 @@ final_system_Makefiles() { #
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -374,9 +338,9 @@ bootscripts_Makefiles() { #
|
||||||
wrt_target "${this_script}" "$PREV"
|
wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
||||||
#
|
#
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
#
|
#
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
[[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
||||||
#
|
#
|
||||||
|
@ -436,17 +400,19 @@ bootable_Makefiles() { #
|
||||||
wrt_target "${this_script}" "$PREV"
|
wrt_target "${this_script}" "$PREV"
|
||||||
#
|
#
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
[[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball"
|
[[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
||||||
#
|
#
|
||||||
# Select a script execution method
|
# Select a script execution method
|
||||||
case $this_script in
|
case $this_script in
|
||||||
*fstab*) if [[ -n "$FSTAB" ]]; then
|
*fstab*) if [[ -n "$FSTAB" ]]; then
|
||||||
wrt_copy_fstab "${this_script}"
|
wrt_copy_fstab "${this_script}"
|
||||||
else
|
else
|
||||||
wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
wrt_RunAsUser "${this_script}" "${file}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) wrt_ExecuteAsUser "clfs" "${this_script}" "${file}"
|
*chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
|
;;
|
||||||
|
*) wrt_RunAsUser "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
|
@ -495,6 +461,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -528,21 +496,21 @@ restart:
|
||||||
|
|
||||||
restore-clfs-env:
|
restore-clfs-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/clfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/clfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown clfs:clfs /home/clfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
do-housekeeping:
|
do-housekeeping:
|
||||||
@-if [ ! -f user-clfs-exist ]; then \\
|
@-if [ ! -f user-clfs-exist ]; then \\
|
||||||
userdel clfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/clfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
50
Config.in
50
Config.in
|
@ -29,6 +29,7 @@ mainmenu "JHALFS Build Script Configuration"
|
||||||
default "./blfs" if BOOK_BLFS
|
default "./blfs" if BOOK_BLFS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--- Book version
|
#--- Book version
|
||||||
#menu "Book Version"
|
#menu "Book Version"
|
||||||
choice
|
choice
|
||||||
|
@ -58,9 +59,56 @@ mainmenu "JHALFS Build Script Configuration"
|
||||||
#--- The full path to a local copy of the book
|
#--- The full path to a local copy of the book
|
||||||
#
|
#
|
||||||
#endmenu
|
#endmenu
|
||||||
|
|
||||||
#-----------------------
|
#-----------------------
|
||||||
|
|
||||||
|
#--- Set User Account
|
||||||
|
config CONFIG_USER
|
||||||
|
bool "Change the default user/group for this build"
|
||||||
|
default n
|
||||||
|
help #--- Unprivileged user and group name
|
||||||
|
# If you do not have the priv to create/delete
|
||||||
|
# users and groups you can specifiy your own
|
||||||
|
# user id for the build
|
||||||
|
# default values for each book
|
||||||
|
# LFS lfs
|
||||||
|
# CLFS clfs
|
||||||
|
# CLFS2 clfs
|
||||||
|
# HLFS hlfs
|
||||||
|
|
||||||
|
config DEF_USER
|
||||||
|
string
|
||||||
|
default "lfs" if BOOK_LFS
|
||||||
|
default "blfs" if BOOK_BLFS
|
||||||
|
default "clfs" if BOOK_CLFS || BOOK_CLFS2
|
||||||
|
default "hlfs" if BOOK_HLFS
|
||||||
|
|
||||||
|
config SET_USER
|
||||||
|
string "User account"
|
||||||
|
depends CONFIG_USER
|
||||||
|
default DEF_USER
|
||||||
|
|
||||||
|
|
||||||
|
config CONFIG_GROUP
|
||||||
|
bool "Set Group?"
|
||||||
|
default n
|
||||||
|
depends CONFIG_USER
|
||||||
|
|
||||||
|
config SET_GROUP
|
||||||
|
string "GROUP account"
|
||||||
|
depends CONFIG_GROUP
|
||||||
|
default DEF_USER
|
||||||
|
|
||||||
|
config LUSER
|
||||||
|
string
|
||||||
|
default DEF_USER if !CONFIG_USER
|
||||||
|
default SET_USER if CONFIG_USER
|
||||||
|
|
||||||
|
config LGROUP
|
||||||
|
string
|
||||||
|
default LUSER if !CONFIG_GROUP
|
||||||
|
default SET_GROUP if CONFIG_GROUP
|
||||||
|
------------------------
|
||||||
|
|
||||||
comment "--------CLFS specific params---------"
|
comment "--------CLFS specific params---------"
|
||||||
depends on BOOK_CLFS || BOOK_CLFS2
|
depends on BOOK_CLFS || BOOK_CLFS2
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,20 @@
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=hlfs
|
||||||
|
LGROUP=hlfs
|
||||||
|
|
||||||
#--- Which library model to use uclibc/glibc
|
#--- Which library model to use uclibc/glibc
|
||||||
MODEL=glibc
|
MODEL=glibc
|
||||||
|
|
||||||
#--- The host system has grsecurity options enabled? 0(no)/1(yes)
|
#--- The host system has grsecurity options enabled? 0(no)/1(yes)
|
||||||
GRSECURITY_HOST=0
|
GRSECURITY_HOST=0
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=hlfs
|
||||||
|
LGROUP=hlfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
124
HLFS/master.sh
124
HLFS/master.sh
|
@ -7,58 +7,6 @@ set -e # Enable error trapping
|
||||||
### FUNCTIONS ###
|
### FUNCTIONS ###
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $2
|
|
||||||
#----------------------------------#
|
|
||||||
local this_user=$1
|
|
||||||
local this_script=$2
|
|
||||||
local file=$3
|
|
||||||
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var
|
|
||||||
#----------------------------------#
|
|
||||||
local USER_ACCT=$1
|
|
||||||
local FILE=$2
|
|
||||||
local optSAVE_PREVIOUS=$3
|
|
||||||
|
|
||||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
|
||||||
wrt_remove_existing_dirs "$FILE"
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@\$(call unpack,$FILE)
|
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
|
||||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
|
||||||
chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_RunAsRoot() { # Some scripts must be run as root..
|
|
||||||
#----------------------------------#
|
|
||||||
local user_ACCT=$(echo $1 | tr [a-z] [A-Z])
|
|
||||||
local this_script=$2
|
|
||||||
local file=$3
|
|
||||||
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { export ${user_ACCT}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -85,11 +33,11 @@ cat << EOF
|
||||||
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
|
wrt_RunAsUser "$toolchain" "$this_script"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
#
|
#
|
||||||
# Safe method to remove packages unpacked outside the toolchain
|
# Safe method to remove packages unpacked while inside the toolchain script
|
||||||
pkg_tarball=$(get_package_tarball_name "binutils")
|
pkg_tarball=$(get_package_tarball_name "binutils")
|
||||||
wrt_remove_existing_dirs "$pkg_tarball"
|
wrt_remove_existing_dirs "$pkg_tarball"
|
||||||
pkg_tarball=$(get_package_tarball_name "gcc-core")
|
pkg_tarball=$(get_package_tarball_name "gcc-core")
|
||||||
|
@ -140,38 +88,38 @@ cat << EOF
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
021-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/hlfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd hlfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-hlfs-exist; \\
|
touch user-hlfs-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown hlfs \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chown hlfs \$(MOUNT_PT)/sources && \\
|
chown \$(LUSER) \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
|
||||||
022-settingenvironment: 021-addinguser
|
022-settingenvironment: 021-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/hlfs/.bash_profile -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/hlfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/hlfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "HLFS=\$(MOUNT_PT)" >> /home/hlfs/.bashrc && \\
|
echo "HLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/hlfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/hlfs/.bashrc && \\
|
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export HLFS LC_ALL PATH" >> /home/hlfs/.bashrc && \\
|
echo "export HLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "" >> /home/hlfs/.bashrc && \\
|
echo "" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
|
echo "target=$(uname -m)-${TARGET}" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
|
echo "ldso=/tools/lib/${LOADER}" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export target ldso" >> /home/lfs/.bashrc && \\
|
echo "export target ldso" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/hlfs/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown hlfs:hlfs /home/hlfs/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -246,13 +194,13 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
||||||
# If $pkg_tarball isn't empty, we've got a package...
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
if [ "$pkg_tarball" != "" ] ; then
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||||
wrt_Unpack_SetOwner "hlfs" "$pkg_tarball"
|
wrt_unpack "$pkg_tarball"
|
||||||
# If using optimizations, write the instructions
|
# If using optimizations, write the instructions
|
||||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||||
fi
|
fi
|
||||||
# Insert date and disk usage at the top of the log file, the script run
|
# Insert date and disk usage at the top of the log file, the script run
|
||||||
# and date and disk usage again at the bottom of the log file.
|
# and date and disk usage again at the bottom of the log file.
|
||||||
wrt_ExecuteAsUser "hlfs" "$this_script" "${file}"
|
wrt_RunAsUser "$this_script" "${file}"
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
# Remove the build directory(ies) except if the package build fails
|
||||||
# (so we can review config.cache, config.log, etc.)
|
# (so we can review config.cache, config.log, etc.)
|
||||||
|
@ -379,7 +327,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
||||||
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*kernfs*)
|
*kernfs*)
|
||||||
wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
|
wrt_RunAsRoot "${this_script}" "${file}"
|
||||||
;;
|
;;
|
||||||
*) # The rest of Chapter06
|
*) # The rest of Chapter06
|
||||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||||
|
@ -521,6 +469,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -568,8 +518,8 @@ restart: restart_code all
|
||||||
|
|
||||||
clean-chapter3:
|
clean-chapter3:
|
||||||
-if [ ! -f user-hlfs-exist ]; then \\
|
-if [ ! -f user-hlfs-exist ]; then \\
|
||||||
userdel hlfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/hlfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
|
@ -597,13 +547,13 @@ clean-chapter7:
|
||||||
|
|
||||||
restore-hlfs-env:
|
restore-hlfs-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/hlfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/hlfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown hlfs:hlfs /home/hlfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -615,8 +565,8 @@ do-housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/sys
|
@-umount \$(MOUNT_PT)/sys
|
||||||
@-umount \$(MOUNT_PT)/proc
|
@-umount \$(MOUNT_PT)/proc
|
||||||
@-if [ ! -f user-hlfs-exist ]; then \\
|
@-if [ ! -f user-hlfs-exist ]; then \\
|
||||||
userdel hlfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/hlfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
restart_code:
|
restart_code:
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
#
|
#
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
#--- Unprivileged user and group name
|
||||||
|
LUSER=lfs
|
||||||
|
LGROUP=lfs
|
||||||
|
|
||||||
#--- Location of fstab file (if empty, a template is created)
|
#--- Location of fstab file (if empty, a template is created)
|
||||||
FSTAB=
|
FSTAB=
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ chapter4_Makefiles() {
|
||||||
|
|
||||||
021-addinguser: 020-creatingtoolsdir
|
021-addinguser: 020-creatingtoolsdir
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ ! -d /home/lfs ]; then \\
|
@if [ ! -d /home/\$(LUSER) ]; then \\
|
||||||
groupadd lfs; \\
|
groupadd \$(LGROUP); \\
|
||||||
useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
||||||
else \\
|
else \\
|
||||||
touch user-lfs-exist; \\
|
touch user-lfs-exist; \\
|
||||||
fi;
|
fi;
|
||||||
@chown lfs \$(MOUNT_PT)/tools && \\
|
@chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
||||||
chmod a+wt \$(MOUNT_PT)/sources && \\
|
chmod a+wt \$(MOUNT_PT)/sources && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -43,20 +43,20 @@ chapter4_Makefiles() {
|
||||||
|
|
||||||
022-settingenvironment: 021-addinguser
|
022-settingenvironment: 021-addinguser
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
||||||
fi;
|
fi;
|
||||||
@echo "set +h" > /home/lfs/.bashrc && \\
|
@echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "umask 022" >> /home/lfs/.bashrc && \\
|
echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
||||||
chown lfs:lfs /home/lfs/.bashrc && \\
|
chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
||||||
touch envars && \\
|
touch envars && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
|
@ -122,8 +122,8 @@ chapter5_Makefiles() {
|
||||||
# and date and disk usage again at the bottom of the log file.
|
# and date and disk usage again at the bottom of the log file.
|
||||||
# The changingowner script must be run as root.
|
# The changingowner script must be run as root.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*changingowner) wrt_run_as_root "${this_script}" "$file" ;;
|
*changingowner) wrt_RunAsRoot "${this_script}" "$file" ;;
|
||||||
*) wrt_run_as_su "${this_script}" "$file" ;;
|
*) wrt_RunAsUser "${this_script}" "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Remove the build directory(ies) except if the package build fails
|
# Remove the build directory(ies) except if the package build fails
|
||||||
|
@ -234,7 +234,7 @@ chapter6_Makefiles() {
|
||||||
# In the mount of kernel filesystems we need to set LFS
|
# In the mount of kernel filesystems we need to set LFS
|
||||||
# and not to use chroot.
|
# and not to use chroot.
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*kernfs) wrt_run_as_root "${this_script}" "$file" ;;
|
*kernfs) wrt_RunAsRoot "${this_script}" "$file" ;;
|
||||||
*) wrt_run_as_chroot1 "${this_script}" "$file" ;;
|
*) wrt_run_as_chroot1 "${this_script}" "$file" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -368,6 +368,8 @@ $HEADER
|
||||||
SRC= /sources
|
SRC= /sources
|
||||||
MOUNT_PT= $BUILDDIR
|
MOUNT_PT= $BUILDDIR
|
||||||
PKG_LST= $PKG_LST
|
PKG_LST= $PKG_LST
|
||||||
|
LUSER= $LUSER
|
||||||
|
LGROUP= $LGROUP
|
||||||
|
|
||||||
include makefile-functions
|
include makefile-functions
|
||||||
|
|
||||||
|
@ -409,8 +411,8 @@ restart: restart_code all
|
||||||
|
|
||||||
clean-chapter4:
|
clean-chapter4:
|
||||||
-if [ ! -f user-lfs-exist ]; then \\
|
-if [ ! -f user-lfs-exist ]; then \\
|
||||||
userdel lfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/lfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
rm -rf \$(MOUNT_PT)/tools
|
rm -rf \$(MOUNT_PT)/tools
|
||||||
rm -f /tools
|
rm -f /tools
|
||||||
|
@ -438,13 +440,13 @@ clean-chapter789:
|
||||||
|
|
||||||
restore-lfs-env:
|
restore-lfs-env:
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
||||||
mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
||||||
fi;
|
fi;
|
||||||
@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
@if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
||||||
mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
||||||
fi;
|
fi;
|
||||||
@chown lfs:lfs /home/lfs/.bash* && \\
|
@chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
||||||
touch \$@ && \\
|
touch \$@ && \\
|
||||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||||
|
@ -456,8 +458,8 @@ do_housekeeping:
|
||||||
@-umount \$(MOUNT_PT)/dev/pts
|
@-umount \$(MOUNT_PT)/dev/pts
|
||||||
@-umount \$(MOUNT_PT)/dev
|
@-umount \$(MOUNT_PT)/dev
|
||||||
@-if [ ! -f user-lfs-exist ]; then \\
|
@-if [ ! -f user-lfs-exist ]; then \\
|
||||||
userdel lfs; \\
|
userdel \$(LUSER); \\
|
||||||
rm -rf /home/lfs; \\
|
rm -rf /home/\$(LUSER); \\
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
restart_code:
|
restart_code:
|
||||||
|
|
27
README
27
README
|
@ -32,15 +32,21 @@ $Id$
|
||||||
::NEWS:: There is new configuration method for jhalfs.
|
::NEWS:: There is new configuration method for jhalfs.
|
||||||
|
|
||||||
We have installed the familiar menu based configuration tool driven by
|
We have installed the familiar menu based configuration tool driven by
|
||||||
make. If you type the command <make> you will be presented with a list of
|
make. If you type the command
|
||||||
configurable parameters (starting with the book you wish to use). All the
|
make
|
||||||
parameters found in the individual config files are available. Once you
|
you will be presented with a list of configurable parameters (starting
|
||||||
have finished setting the parameters and exit the make file will launch
|
with the book you wish to use). All the parameters found in the individual
|
||||||
the chosen book version of jhalfs. JHALFS will import your created file
|
config files are available. Once you have finished setting the parameters
|
||||||
and overider the values found in normal "config" files.
|
and exit the make file will launch the chosen book version of jhalfs.
|
||||||
|
JHALFS will import your created file and overider the values found in normal
|
||||||
|
"config" files.
|
||||||
..note.. The generated file <configuration> is only used by jhalfs if you
|
..note.. The generated file <configuration> is only used by jhalfs if you
|
||||||
run jhalfs via make otherwise it is ignored.
|
run jhalfs via make otherwise it is ignored.
|
||||||
|
|
||||||
|
If you want to try out the new configuration system without running jhalfs
|
||||||
|
issue the following.
|
||||||
|
make menuconfig
|
||||||
|
This will create a new file named configuration but will not launch jhalfs.
|
||||||
|
|
||||||
4. RUNNING::
|
4. RUNNING::
|
||||||
The script master.sh cannot be invoked directly but only via the
|
The script master.sh cannot be invoked directly but only via the
|
||||||
|
@ -158,6 +164,7 @@ $Id$
|
||||||
|
|
||||||
Q. "It doesn't work!"
|
Q. "It doesn't work!"
|
||||||
A. Yes it does, try ./lfs --help
|
A. Yes it does, try ./lfs --help
|
||||||
|
Remember you must either be 'root' to run this script or have 'sudo' privileges.
|
||||||
|
|
||||||
Q. "It still doesn't work"
|
Q. "It still doesn't work"
|
||||||
A. jhalfs was designed to work against the developement versions of the LFS
|
A. jhalfs was designed to work against the developement versions of the LFS
|
||||||
|
@ -200,6 +207,14 @@ $Id$
|
||||||
simple and reliable method of doing so. This method also handles the CLFS
|
simple and reliable method of doing so. This method also handles the CLFS
|
||||||
build method where the final build may be done on a separate machine.
|
build method where the final build may be done on a separate machine.
|
||||||
|
|
||||||
|
Q. "What is the function of LUSER and LGROUP? There is no cmd line switch"
|
||||||
|
A. If you are running jhalfs from a low or non-priveledged account you may not
|
||||||
|
have the priv to create/delete accounts. These variables are adjustable
|
||||||
|
when invoking make.
|
||||||
|
make LUSER=myaccount LGROUP=mygroup
|
||||||
|
Then only changes to your account will be the creation of a NEW .bashrc after
|
||||||
|
saving your original to .bashrc.XXX
|
||||||
|
|
||||||
Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point"
|
Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point"
|
||||||
A. There could be numerous reasons for the failure but the most likely reason
|
A. There could be numerous reasons for the failure but the most likely reason
|
||||||
is you are doing a cross-build using the 'chroot' method and the target is
|
is you are doing a cross-build using the 'chroot' method and the target is
|
||||||
|
|
|
@ -254,6 +254,7 @@ get_package_tarball_name() { #
|
||||||
#
|
#
|
||||||
case $script_name in
|
case $script_name in
|
||||||
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
||||||
|
linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
||||||
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
*) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -309,27 +310,7 @@ cat << EOF
|
||||||
@\$(call unpack,$FILE)
|
@\$(call unpack,$FILE)
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
||||||
chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
chown -R \$(LUSER) \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_unpack_clfs() { # Unpack and set 'ROOT' var
|
|
||||||
#----------------------------------#
|
|
||||||
local FILE=$1
|
|
||||||
local optSAVE_PREVIOUS=$2
|
|
||||||
|
|
||||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
|
||||||
wrt_remove_existing_dirs "$FILE"
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@\$(call unpack,$FILE)
|
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
|
||||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
|
||||||
chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
@ -379,7 +360,7 @@ wrt_test_log() { # Initialize testsuite log file
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
@echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
|
||||||
su - lfs -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
|
su - \$(LUSER) -c "echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE"
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
}
|
}
|
||||||
|
@ -410,13 +391,13 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_run_as_su() { # Execute script inside time { }, footer to log file
|
wrt_RunAsUser() { # Execute script inside time { }, footer to log file
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
local this_script=$1
|
local this_script=$1
|
||||||
local file=$2
|
local file=$2
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
@( time { su - \$(LUSER) -c "source /home/\$(LUSER)/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -424,41 +405,24 @@ EOF
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_run_as_root() { # Some scripts must be run as root..
|
wrt_RunAsRoot() { # Some scripts must be run as root..
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
|
local ENV_MOUNT
|
||||||
local this_script=$1
|
local this_script=$1
|
||||||
local file=$2
|
local file=$2
|
||||||
|
|
||||||
|
case ${PROGNAME} in
|
||||||
|
lfs ) MOUNT_ENV="LFS" ;;
|
||||||
|
blfs ) MOUNT_ENV="BLFS" ;;
|
||||||
|
clfs ) MOUNT_ENV="CLFS" ;;
|
||||||
|
clfs2 ) MOUNT_ENV="CLFS" ;;
|
||||||
|
hlfs ) MOUNT_ENV="HLFS" ;;
|
||||||
|
*) echo "undefined progname $PROGNAME"; exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
@( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_run_as_clfs_su() { # Execute script inside time { }, footer to log file
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_run_as_clfs_root() { # Some scripts must be run as root..
|
|
||||||
#----------------------------------#
|
|
||||||
local this_script=$1
|
|
||||||
local file=$2
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@( time { export CLFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
|
||||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -479,7 +443,6 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
wrt_run_as_chroot1() { #
|
wrt_run_as_chroot1() { #
|
||||||
#----------------------------------#
|
#----------------------------------#
|
||||||
|
@ -538,9 +501,9 @@ wrt_remove_build_dirs() { #
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
||||||
if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
|
if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
|
||||||
rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
rm -rf \$(MOUNT_PT)\$(SRC)/$name-build; \\
|
||||||
fi;
|
fi;
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
@ -554,9 +517,9 @@ wrt_remove_build_dirs2() { #
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||||
rm -r \$(SRC)/\$\$ROOT && \\
|
rm -rf \$(SRC)/\$\$ROOT && \\
|
||||||
if [ -e \$(SRC)/$name-build ]; then \\
|
if [ -e \$(SRC)/$name-build ]; then \\
|
||||||
rm -r \$(SRC)/$name-build; \\
|
rm -rf \$(SRC)/$name-build; \\
|
||||||
fi;
|
fi;
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
|
|
|
@ -86,10 +86,10 @@ validate_config() { # Are the config values sane (within reason)
|
||||||
inline_doc
|
inline_doc
|
||||||
|
|
||||||
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
|
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
|
||||||
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL"
|
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL LUSER LGROUP"
|
||||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
|
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
|
||||||
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG"
|
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
|
||||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG"
|
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP"
|
||||||
|
|
||||||
local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
|
local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
|
||||||
local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
|
local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
|
||||||
|
@ -213,6 +213,12 @@ inline_doc
|
||||||
METHOD) validate_against_str "xchrootx xbootx" ;;
|
METHOD) validate_against_str "xchrootx xbootx" ;;
|
||||||
ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;;
|
ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;;
|
||||||
TARGET) validate_target ;;
|
TARGET) validate_target ;;
|
||||||
|
LUSER) echo -e "`eval echo $PARAM_VALS`"
|
||||||
|
[[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
|
||||||
|
;;
|
||||||
|
LGROUP) echo -e "`eval echo $PARAM_VALS`"
|
||||||
|
[[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
|
||||||
|
;;
|
||||||
GRSECURITY_HOST) validate_against_str "x0x x1x" ;;
|
GRSECURITY_HOST) validate_against_str "x0x x1x" ;;
|
||||||
|
|
||||||
# BOOK validation. Very ugly, need be fixed
|
# BOOK validation. Very ugly, need be fixed
|
||||||
|
|
|
@ -70,6 +70,8 @@ source $MODULE
|
||||||
|
|
||||||
if [[ -e using_menuconfig ]]; then
|
if [[ -e using_menuconfig ]]; then
|
||||||
source configuration
|
source configuration
|
||||||
|
|
||||||
|
|
||||||
#--- Working directories
|
#--- Working directories
|
||||||
SCRIPT_ROOT=jhalfs
|
SCRIPT_ROOT=jhalfs
|
||||||
JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
|
JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
|
||||||
|
|
Reference in a new issue