Add a "shdir" setting to config.
This is to make moving the bash code around easier.
It also reduces more hardcoded paths in the bash scripts.
Migrate all target shell scripts to use the new shdir setting
confdefaults={
"storedir": "/var/tmp/catalyst",
"sharedir": "/usr/lib/catalyst",
- "shdir": "/usr/lib/catalyst/targets/",
+ "shdir": "%(sharedir)s/targets",
"distdir": "/usr/portage/distfiles",
"repo_name": "portage",
"portdir": "/usr/portage",
# portdir specifies the source portage tree used by the snapshot target.
portdir="/usr/portage"
-# sharedir specifies where all of the catalyst runtime executables are. Most
-# users do not need to change this.
+# sharedir specifies where all of the catalyst runtime executables
+# and other shared lib objects are.
+# Most users do not need to change this.
sharedir="/usr/lib/catalyst"
+# shdir specifies where all of the catalyst runtime executables are.
+shdir="%(sharedir)s/targets"
+
# snapshot_cache specifies where the snapshots will be cached to if snapcache is
# enabled in the options.
snapshot_cache="/var/tmp/catalyst/snapshot_cache"
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
case ${1} in
enter)
shift
export clst_packages="$*"
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
preclean)
# export root_fs_path="${clst_chroot_path}/tmp/mergeroot"
# install -d ${clst_image_path}
-# ${clst_sharedir}/targets/embedded/embedded-fs-runscript.sh \
+# ${clst_shdir}/embedded/embedded-fs-runscript.sh \
# ${clst_embedded_fs_type} || exit 1
# imagesize=`du -sk ${clst_image_path}/root.img | cut -f1`
# echo "Created ${clst_embedded_fs_type} image at \
pre-kmerge)
# Sets up the build environment before any kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
post-kmerge)
# Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
;;
kernel)
then
cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
fi
- exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot tmp/linuxrc
;;
target_image_setup)
shift
- ${clst_sharedir}/targets/support/target_image_setup.sh ${1}
+ ${clst_shdir}/support/target_image_setup.sh ${1}
;;
livecd-update)
# Now, finalize and tweak the livecd fs (inside of the chroot)
- exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh
+ exec_in_chroot ${clst_shdir}/support/livecdfs-update.sh
;;
bootloader)
# Here is where we poke in our identifier
touch ${1}/livecd
- ${clst_sharedir}/targets/support/bootloader-setup.sh ${1}
+ ${clst_shdir}/support/bootloader-setup.sh ${1}
;;
iso)
shift
- ${clst_sharedir}/targets/support/create-iso.sh ${1}
+ ${clst_shdir}/support/create-iso.sh ${1}
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
case $1 in
enter)
shift
export clst_grp_packages="$*"
- exec_in_chroot ${clst_sharedir}/targets/grp/grp-chroot.sh
+ exec_in_chroot ${clst_shdir}/grp/grp-chroot.sh
;;
preclean)
- exec_in_chroot ${clst_sharedir}/targets/grp/grp-preclean-chroot.sh
+ exec_in_chroot ${clst_shdir}/grp/grp-preclean-chroot.sh
;;
clean)
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
## START RUNSCRIPT
export clst_packages="$*"
mkdir -p ${clst_chroot_path}/usr/livecd ${clst_chroot_path}/tmp
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
echo "${clst_packages}" > ${clst_chroot_path}/tmp/packages.txt
;;
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
case $1 in
pre-kmerge)
# Sets up the build environment before any kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
post-kmerge)
# Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
;;
kernel)
then
cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
fi
- exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot tmp/linuxrc
extract_modules ${clst_chroot_path} ${clst_kname}
livecd-update)
# Now, finalize and tweak the livecd fs (inside of the chroot)
- exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh
+ exec_in_chroot ${clst_shdir}/support/livecdfs-update.sh
# Move over the xinitrc (if applicable)
# This is moved here, so we can override any default xinitrc
;;
rc-update)
- exec_in_chroot ${clst_sharedir}/targets/support/rc-update.sh
+ exec_in_chroot ${clst_shdir}/support/rc-update.sh
;;
fsscript)
;;
esac
- ${clst_sharedir}/targets/support/bootloader-setup.sh $1
+ ${clst_shdir}/support/bootloader-setup.sh $1
;;
unmerge)
shift
export clst_packages="$*"
- exec_in_chroot ${clst_sharedir}/targets/support/unmerge.sh
+ exec_in_chroot ${clst_shdir}/support/unmerge.sh
;;
target_image_setup)
shift
- ${clst_sharedir}/targets/support/target_image_setup.sh $1
+ ${clst_shdir}/support/target_image_setup.sh $1
;;
iso)
shift
- ${clst_sharedir}/targets/support/create-iso.sh $1
+ ${clst_shdir}/support/create-iso.sh $1
;;
esac
exit $?
#!/bin/bash
-source ${clst_sharedir}/targets/support/chroot-functions.sh
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/chroot-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
update_env_settings
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
case ${1} in
clst_root_path="/" \
clst_packages="$*" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
busybox)
clst_myemergeopts="${clst_myemergeopts} -O" \
clst_packages="busybox" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
pre-kmerge)
# Sets up the build environment before any kernels are compiled
- #exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
+ #exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
post-kmerge)
# Cleans up the build environment after the kernels are compiled
- #exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ #exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
;;
kernel)
shift
export clst_kname="$1"
export clst_root_path="/"
- #exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
- #exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
- #exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ #exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
+ #exec_in_chroot ${clst_shdir}/support/kmerge.sh
+ #exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
#extract_kernels kernels
;;
clst_myemergeopts="${clst_myemergeopts} --nodeps" \
clst_packages="netboot-base" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
clst_files="${@}" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-image.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-image.sh
;;
finish)
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-combine.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-combine.sh
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
case ${1} in
build_packages)
clst_root_path="/" \
clst_packages="$*" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-pkg.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-pkg.sh
;;
pre-kmerge)
# Sets up the build environment before any kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
post-kmerge)
# Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
;;
kernel)
cp ${clst_busybox_config} ${clst_chroot_path}/tmp/busy-config
fi
- exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot tmp/linuxrc
delete_from_chroot tmp/busy-config
# Copy remaining files over to the initramfs target
clst_files="${@}" \
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-copyfile.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-copyfile.sh
;;
final)
# For each arch, fetch the kernel images and put them in builds/
echo -e ">>> Copying completed kernels to ${clst_target_path} ..."
- ${clst_sharedir}/targets/support/netboot2-final.sh
+ ${clst_shdir}/support/netboot2-final.sh
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
case $1 in
enter)
;;
run)
- cp ${clst_sharedir}/targets/stage1/build.py ${clst_chroot_path}/tmp
+ cp ${clst_shdir}/stage1/build.py ${clst_chroot_path}/tmp
# Setup "ROOT in chroot" dir
install -d ${clst_chroot_path}/${clst_root_path}/etc
install -d ${clst_chroot_path}/${clst_root_path}/etc/portage
# Setup make.conf and make.profile link in "ROOT in chroot":
- copy_to_chroot ${clst_chroot_path}/etc/portage/make.conf /${clst_root_path}/etc/portage
+ copy_to_chroot ${clst_chroot_path}/etc/portage/make.conf ${clst_root_path}/etc/portage
# Enter chroot, execute our build script
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh \
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh \
|| exit 1
;;
preclean)
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh || exit 1
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh || exit 1
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
# Only put commands in this section that you want every target to execute.
# This is a global default file and will affect every target
shift
export clst_packages="$*"
exec_in_chroot \
- ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
preclean)
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
# Only put commands in this section that you want every target to execute.
# This is a global default file and will affect every target
run)
shift
export clst_packages="$*"
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
preclean)
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
# Only put commands in this section that you want every target to execute.
# This is a global default file and will affect every target
pre-kmerge)
# Sets up the build environment before any kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/pre-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
post-kmerge)
# Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_sharedir}/targets/support/post-kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
;;
kernel)
then
cp -pPR ${clst_linuxrc} ${clst_chroot_path}/tmp/linuxrc
fi
- exec_in_chroot ${clst_sharedir}/targets/support/kmerge.sh
+ exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot tmp/linuxrc
extract_modules ${clst_chroot_path} ${clst_kname}
# Do we need this one?
build_packages)
shift
export clst_packages="$*"
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-chroot.sh
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-chroot.sh
;;
preclean)
- exec_in_chroot ${clst_sharedir}/targets/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
+ exec_in_chroot ${clst_shdir}/${clst_target}/${clst_target}-preclean-chroot.sh ${clst_root_path}
;;
rc-update)
- exec_in_chroot ${clst_sharedir}/targets/support/rc-update.sh
+ exec_in_chroot ${clst_shdir}/support/rc-update.sh
;;
fsscript)
livecd-update)
# Now, finalize and tweak the livecd fs (inside of the chroot)
- exec_in_chroot ${clst_sharedir}/targets/support/livecdfs-update.sh
+ exec_in_chroot ${clst_shdir}/support/livecdfs-update.sh
# Move over the xinitrc (if applicable)
# This is moved here, so we can override any default xinitrc
target_image_setup)
shift
- ${clst_sharedir}/targets/support/target_image_setup.sh $1
+ ${clst_shdir}/support/target_image_setup.sh $1
;;
unmerge)
shift
export clst_packages="$*"
- exec_in_chroot ${clst_sharedir}/targets/support/unmerge.sh
+ exec_in_chroot ${clst_shdir}/support/unmerge.sh
;;
iso)
shift
- ${clst_sharedir}/targets/support/create-iso.sh $1
+ ${clst_shdir}/support/create-iso.sh $1
;;
clean)
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
# $1 is the destination root
[ -d "${1}/boot" ] && rmdir ${1}/boot
# Source the arcload source file to generated required sections of arc.cf
- source ${clst_sharedir}/targets/support/mips-arcload_conf.sh
+ source ${clst_shdir}/support/mips-arcload_conf.sh
# Generate top portions of the config
echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
## START RUNSCRIPT
echo "Copying ${file_name} to ${destdir}"
copy_to_chroot ${1} ${destdir}
- copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
+ copy_to_chroot ${clst_shdir}/support/chroot-functions.sh \
${destdir}
chroot_path=${clst_chroot_path}${subdir}
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
extract_kernels ${clst_target_path}boot
-source ${clst_sharedir}/targets/support/functions.sh
-source ${clst_sharedir}/targets/support/filesystem-functions.sh
+source ${clst_shdir}/support/functions.sh
+source ${clst_shdir}/support/filesystem-functions.sh
# Make the directory if it doesnt exist
mkdir -p $1
#!/bin/bash
-source ${clst_sharedir}/targets/support/functions.sh
+source ${clst_shdir}/support/functions.sh
case $1 in
run)
shift
- exec_in_chroot ${clst_sharedir}/targets/tinderbox/tinderbox-chroot.sh
+ exec_in_chroot ${clst_shdir}/tinderbox/tinderbox-chroot.sh
;;
preclean)
- #exec_in_chroot ${clst_sharedir}/targets/tinderbox/tinderbox-preclean-chroot.sh
+ #exec_in_chroot ${clst_shdir}/tinderbox/tinderbox-preclean-chroot.sh
delete_from_chroot /tmp/chroot-functions.sh
;;
clean)