Fix handling of the 'custom' directory symlink.

Properly abstract the PicoBSD build directory instead of depending too much
on pwd's and relative paths.

Submitted by:	 John Baldwin <jobaldwi@vt.edu>
This commit is contained in:
dwhite 1999-10-11 20:52:50 +00:00
parent fd8b4427a5
commit ad345ff4e4
2 changed files with 14 additions and 9 deletions

View File

@ -33,6 +33,10 @@ set -e
. ../Version . ../Version
# support symbolically linked custom directory
BUILDDIR=`pwd`
export BUILDDIR
# assign default values to variables. # assign default values to variables.
set_defaults() { set_defaults() {
TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ... TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ...
@ -90,7 +94,7 @@ main() {
# Build the kernel, if necessary # Build the kernel, if necessary
echo "" echo ""
echo "-> Checking if we have to build the PICOBSD kernel..." echo "-> Checking if we have to build the PICOBSD kernel..."
(cd ../${TYPE}; make -f ../build/Makefile.conf ) (cd ../${TYPE}; make -f ${BUILDDIR}/Makefile.conf )
echo "" echo ""
./stage1 ./stage1
@ -122,6 +126,7 @@ check_for_old_custom() {
CUSTOMLINK=`ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'` CUSTOMLINK=`ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'`
if dialog --title "Custom directory setup" --yesno "A custom configuration\n ${CUSTOMLINK}\nalready exists. Would you like to use it?" 7 50 ; then if dialog --title "Custom directory setup" --yesno "A custom configuration\n ${CUSTOMLINK}\nalready exists. Would you like to use it?" 7 50 ; then
KEEP_CUSTOM=yes KEEP_CUSTOM=yes
CUST_DIR=${CUSTOMLINK}
else else
KEEP_CUSTOM=no KEEP_CUSTOM=no
fi fi
@ -337,7 +342,7 @@ WARNING: the contents of the floppy will be permanently erased!\n\
\n\ \n\
Your options:\n\ Your options:\n\
* ^C or [Cancel] to abort,\n\ * ^C or [Cancel] to abort,\n\
* Enter to install \"${FILENAME}\",\n\ * Enter to install \"picobsd.bin\",\n\
* name of other file to install.\n\ * name of other file to install.\n\
" 20 70 2> ${RISU} " 20 70 2> ${RISU}
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then

View File

@ -92,7 +92,7 @@ fi
MFS_RC=floppy.tree/etc/mfs.rc MFS_RC=floppy.tree/etc/mfs.rc
if [ ! -f ${MFS_RC} ] ; then # no private version. use generic mfs.rc if [ ! -f ${MFS_RC} ] ; then # no private version. use generic mfs.rc
MFS_RC=../${MFS_RC} MFS_RC=${BUILDDIR}/../${MFS_RC}
fi fi
if [ "${INIT}" = "oinit" ] ; then if [ "${INIT}" = "oinit" ] ; then
cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > /mnt/etc/oinit.rc cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > /mnt/etc/oinit.rc
@ -101,7 +101,7 @@ else
if [ -f floppy.tree/etc/mfs.login.conf ] ; then if [ -f floppy.tree/etc/mfs.login.conf ] ; then
cp floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf cp floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf
else else
cp ../floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf cp ${BUILDDIR}/../floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf
fi fi
cat lang/README.${LANGUAGE} | sed -e "s/@VER@/${VER}/g" > /mnt/README cat lang/README.${LANGUAGE} | sed -e "s/@VER@/${VER}/g" > /mnt/README
fi fi
@ -178,7 +178,7 @@ mount /dev/vn0c /mnt
echo "-> Populating floppy filesystem..." echo "-> Populating floppy filesystem..."
### copy floppy tree excluding private files. ### copy floppy tree excluding private files.
excl=../${TYPE}/floppy.tree.exclude excl=${BUILDDIR}/../${TYPE}/floppy.tree.exclude
if [ -f ${excl} ] ; then if [ -f ${excl} ] ; then
excl="--exclude-from ${excl}" excl="--exclude-from ${excl}"
echo "Exclude following files from ${excl}:\n===" echo "Exclude following files from ${excl}:\n==="
@ -187,17 +187,17 @@ if [ -f ${excl} ] ; then
else else
excl="" excl=""
fi fi
(cd ../floppy.tree ; tar -cf - ${excl} . ) | (cd /mnt ; tar xvf - ) (cd ${BUILDDIR}/../floppy.tree ; tar -cf - ${excl} . ) | (cd /mnt ; tar xvf - )
if [ -d ../${TYPE}/floppy.tree ] ; then if [ -d ${BUILDDIR}/../${TYPE}/floppy.tree ] ; then
echo "-> update with private files:" echo "-> update with private files:"
(cd ../${TYPE}/floppy.tree ; tar cf - . ) | (cd /mnt ; tar xvf - ) (cd ${BUILDDIR}/../${TYPE}/floppy.tree ; tar cf - . ) | (cd /mnt ; tar xvf - )
fi fi
files="hosts motd" files="hosts motd"
echo "-> Copying language dependent files: ${files} -> /mnt/etc ..." echo "-> Copying language dependent files: ${files} -> /mnt/etc ..."
for i in ${files} ; do for i in ${files} ; do
cat ../${TYPE}/lang/${i}.${LANGUAGE} | \ cat ${BUILDDIR}/../${TYPE}/lang/${i}.${LANGUAGE} | \
sed -e "s/@VER@/${VER}/g" > /mnt/etc/${i} sed -e "s/@VER@/${VER}/g" > /mnt/etc/${i}
done done