## /usr/libexec/src2pkg/FUNCTIONS ## src2pkg FUNCTIONS Version-2.0 ## src2pkg - Copyright 2005-2010 Gilbert Ashley ## src2pkg is free software released under the GNU General Public License Version 2 # How were we called? EXEC_NAME="${0##*/}" # Where were we called from? CWD ! [[ "$CWD" ]] && CWD="$(pwd)" #&& export CWD # Setting AUTORIZE_USERS to YES only allows users who are members # of the src2pkg group to run src2pkg. root user is not authorized if [[ $AUTHORIZE_USERS = "YES" ]] && [[ $EUID -ne 0 ]] ; then if [[ "$(grep src2pkg /etc/group |grep $USER)" = "" ]] ; then echo $RED"FAILURE!"$NORMAL" Sorry, you are not allowed to use src2pkg." echo "Ask your administrator for more details." fi fi # Users can have a personal $HOME/.src2pkg.conf file for their own settings. If AUTHORIZE_USER_CONF # is set to YES, only users who are members of the scr2pkg group will be allowed to use a personal conf file. # The personal conf file is read first and then the GLOBAL_CONF. This allows a system administrator a # chance to override any settings in the users' personal conf file, if needed or wanted. if ! [[ $HAVE_CONF ]] ; then # when using the src2pkg wrapper, the conf file(s) get read early. Since they would get read # again when/if a script gets sourced, HAVE_CONF is used to avoid reading them a second time. if [[ -e "$HOME"/.src2pkg.conf ]] && [[ $AUTHORIZE_USER_CONF = "YES" ]] && [[ $EUID -ne 0 ]] ; then if [[ "$(grep src2pkg /etc/group |grep $USER)" != "" ]] ; then if [[ -e "$HOME"/.src2pkg.conf ]] ; then [ "$DEBUG" -o "$QUIET" = "NO" ] && echo $BLUE"Found personal src2pkg.conf - "$NORMAL"Reading $HOME/.src2pkg.conf" . "$HOME"/.src2pkg.conf if [[ $? != 0 ]] ; then echo $RED"Failed!"$NORMAL"Error returned while reading $HOME/.src2pkg.conf" echo "Please check for bad syntax or illegal commands." exit fi fi else echo $YELLOW"Warning!"$NORMAL" You are not authorized to use a .src2pkg.conf file in your HOME directory." echo "You must be included in the 'src2pkg' group in order to use a $HOME/.src2pkg.conf file." fi else if [[ -e "$HOME"/.src2pkg.conf ]] ; then [ "$DEBUG" -o "$QUIET" = "NO" ] && echo $BLUE"Found personal src2pkg.conf - "$NORMAL"Reading $HOME/.src2pkg.conf" . "$HOME"/.src2pkg.conf if [[ $? != 0 ]] ; then echo $RED"Failed!"$NORMAL"Error returned while reading $HOME/.src2pkg.conf" echo "Please check for bad syntax or illegal commands." exit fi fi fi # If GLOBAL_CONF is not specified, look for the default src2pkg.conf file if [[ "$GLOBAL_CONF" != "" ]] ; then # if the GLOBAL_CONF is specified, make sure the user is root -otherwise ignore the request if [[ "$EUID" = 0 ]] ; then if [[ -e $GLOBAL_CONF ]] ; then [ "$DEBUG" -o "$QUIET" = "NO" ] && echo $BLUE"Found global src2pkg.conf - "$NORMAL"Reading $GLOBAL_CONF" . $GLOBAL_CONF if [[ $? != 0 ]] ; then echo $RED"Failed!"$NORMAL"Error returned while reading $GLOBAL_CONF" echo "Please check for bad syntax or illegal commands." exit fi else echo $YELLOW"Notice! "$NORMAL"$GLOBAL_CONF not found." fi else echo $YELLOW"Warning! "$NORMAL"Only root can override the GLOBAL_CONF variable!" GLOBAL_CONF="/etc/src2pkg/src2pkg.conf" if [[ -e $GLOBAL_CONF ]] ; then [ "$DEBUG" -o "$QUIET" = "NO" ] && echo $BLUE"Using default global src2pkg.conf - "$NORMAL"Reading $GLOBAL_CONF" . $GLOBAL_CONF if [[ $? != 0 ]] ; then echo $RED"Failed!"$NORMAL"Error returned while reading $GLOBAL_CONF" echo "Please check for bad syntax or illegal commands." exit fi fi fi else GLOBAL_CONF="/etc/src2pkg/src2pkg.conf" if [[ -e $GLOBAL_CONF ]] ; then [ "$DEBUG" -o "$QUIET" = "NO" ] && echo $BLUE"Found global src2pkg.conf - "$NORMAL"Reading $GLOBAL_CONF" . $GLOBAL_CONF if [[ $? != 0 ]] ; then echo $RED"Failed!"$NORMAL"Error returned while reading $GLOBAL_CONF" echo "Please check for bad syntax or illegal commands." exit fi fi fi fi # You could also keep more than one configuration file as separate 'profiles' # and use the GLOBAL_CONF variable to control their use. This could be # used in much the same way as gentoo 'USE' or conary 'FLAVOR', # allowing you to set a group of global variables for particular ARCH's, etc # Clear all aliases which might inetrfere with src2pkg functionality unalias -a # This variable allows you to run src2pkg from a non-standard location, if # needed. Then just make sure that DEFINES, FUNCTIONS and all the # separate function files are in the same directory. This would allow you # to run src2pkg from your $HOME directory or can be used to 'bootstrap' # src2pkg with itself. ! [[ $SRC2PKG_LIBDIR ]] && SRC2PKG_LIBDIR=/usr/libexec/src2pkg # having this as a variable allows for possible installation in another location ! [[ $SRC2PKG_BINDIR ]] && SRC2PKG_BINDIR=/usr/libexec/src2pkg/bin # add this path to the users' PATH. This must go in front of the normal PATH export PATH=$SRC2PKG_BINDIR:$PATH # Load function for eliminating whitespace early: white_out() { while read GAGA ; do echo $GAGA done } ## The DEFINES file sets some very important default variables which are needed for ## the individual functions. These variables set up the basic default behaviour of ## src2pkg. Advanced users could conceivably change some of the basic defaults ## by editing the DEFINES file. However, a better way is to put any permanent ## defaults in the src2pkg.conf file using the same syntax as is used in DEFINES ## The DEFINES file is kept separate so that no one should need to edit this ## FUNCTIONS file or any of the individual function files sourced by this file. ## The DEFINES file must be present for src2pkg to run correctly. ! [[ $DEFINES ]] && DEFINES=$SRC2PKG_LIBDIR/DEFINES if [[ -e $DEFINES ]] ; then source $DEFINES else echo "Warning! DEFINES file not found." FAILED="NO DEFINES FILE" exit 0 fi # export this as it may speed up sorting routines export LANG=C export LC_ALL=C ## This FUNCTIONS file used to contain *all* the src2pkg code except for ## what is found in the DEFINES file. But, since the code base has become ## quite large, since src2pkg-1.9 the code has been split up into separate ## files. This should make it easier to read and understand for those who ## are interested and makes it easier to work on for myself (and contributors). ## src2pkg is based on shell functions, each of which performs the ## steps associated with one step of preparing and building a package. ## So, each file mostly contains all the code which is used by each of the 16 ## src2pkg package-building instruction or steps. The names of each file ## are the same as the name of the src2pkg function, preceeded by a number ## which makes them easier to follow and to find specific parts of the code. ## The only exception to this is for the fake_install function. Since src2pkg ## can use any one of 3 different methods for creating the package content ## and the code is rather long, each of these methods is contained in a ## separate file. the file 08-fake_install contains the main function and ## the files 08A*, 08B* and 08C* contain the sub-functions. ## Another extra file has been added: 14A-last_minute_details contains ## a bunch of related code which is run just before package creation. The ## routines are called at the end of make_doinst, so there is still a chance ## to insert manual code in a src2pkg script after these routines are run, ## but before actual package creation takes place in make_package ## 'source' each of the smaller functions file to read in the code . $SRC2PKG_LIBDIR/01-pre_process . $SRC2PKG_LIBDIR/02-find_source . $SRC2PKG_LIBDIR/03-make_dirs . $SRC2PKG_LIBDIR/04-unpack_source . $SRC2PKG_LIBDIR/05-fix_source_perms . $SRC2PKG_LIBDIR/06-configure_source . $SRC2PKG_LIBDIR/07-compile_source . $SRC2PKG_LIBDIR/08-fake_install # these are now read in as-needed from 08-fake_install # . $SRC2PKG_LIBDIR/08A-destdir_install # . $SRC2PKG_LIBDIR/08B-jail_root_install # . $SRC2PKG_LIBDIR/08C-real_root_install # . $SRC2PKG_LIBDIR/08D-union_root_install . $SRC2PKG_LIBDIR/09-fix_pkg_perms . $SRC2PKG_LIBDIR/10-strip_bins . $SRC2PKG_LIBDIR/11-create_docs . $SRC2PKG_LIBDIR/12-compress_man_pages . $SRC2PKG_LIBDIR/13-make_description . $SRC2PKG_LIBDIR/14-make_doinst . $SRC2PKG_LIBDIR/14A-last_minute_details . $SRC2PKG_LIBDIR/15-make_package . $SRC2PKG_LIBDIR/16-post_process ## None of the code in the above files is actually executed until the functions are ## called by the src2pkg program or from a src2pkg script. A standard src2pkg script ## calls the 16 steps in order as does the src2pkg command-line program. The program ## 'trackinstall' which is included with src2pkg is similar to checkinstall. Since it ## works with already decompressed and (mostly) compiled sources, it does not need ## all the steps. So only a partial list of them is called by trackinstall. Some of the src2pkg ## command-line options also use only a partial list of the functions. ### When no special code is needed and all processing steps can be succesfully run when ### building a package, it is possible to substitute the list of 16 steps (the functions) with ### a single 'short-cut' function which is named do_all_processes. ### The function do_all_processes summarizes the default execution order into a single ### command. Showing this here provides an overview of the standard list of commands. ### Most of the functions in this list also call other internal functions. But this list is the ### list used for a standard build and combined with the variables constitutes an API. ### Function do_all_processes ######################################## do_all_processes() { # This is exactly the way the functions are written in a standard src2pkg script: pre_process find_source make_dirs unpack_source fix_source_perms configure_source compile_source fake_install fix_pkg_perms strip_bins create_docs compress_man_pages make_description make_doinst make_package post_process } ### End Function do_all_processes ####################################### ### Processing Functions ## As mentioned above, the indiviudal processing functions which each perform a separate ## step in the package-making process have been split out into individual files. Some of the ## main functions which correspond to the list above also call sub-functions. Most of these ## sub-functions will be found in the same file they are called from. So, the only thing left ## in this file are a few small general functions which are called by various other functions. ## General Functions used internally ## User cancelled at a safe place, so don't warn safe_user_cancel() { USER_CANCELLED=1 ERROR=2 } user_cancel() { echo FAILED="CANCELLED" case $AUDIO_NOTIFICATION in BEEP) echo -ne '\a';sleep .5;echo -ne '\a' ;; SAY) case $TTS_ENGINE in flite) flite "Build cancelled" 2> /dev/null ;; festival) echo "Build cancelled" |festival --tts 2> /dev/null ;; esac ;; PLAY) play /usr/share/src2pkg/sounds/ouch &> /dev/null ;; esac exit 2 } # this gets used by 08B-jail_root_install or 08C-real_root_install emergency_restore() { echo " Please don't interrupt while creating content!" rm -rf "$BACKUP_DIR"/$NAME-$VERSION-backup-$BUILD$SIG/BACKUP/no-backup &> /dev/null ls "$BACKUP_DIR"/$NAME-$VERSION-backup-$BUILD$SIG/* &> /dev/null if [[ $? -eq 0 ]] ; then if [[ $(ls "$BACKUP_DIR"/$NAME-$VERSION-backup-$BUILD$SIG/*) != "" ]] ; then cd "$BACKUP_DIR"/$NAME-$VERSION-backup-$BUILD$SIG/BACKUP echo " Peforming emergency restoration of backup files!" ${TAR} -cpf - . | ${TAR} -f - -xvpC / # &> /dev/null RETVAL=$? # INSTW_ROOTPATH must be unset or "$BACKUP_DIR" is un-removeable unset INSTW_ROOTPATH unset LD_PRELOAD if [[ $RETVAL -eq 0 ]] ; then echo $CYAN" Notice - "$NORMAL"Backup file restoration "$GREEN"Okay"$NORMAL if ! [[ $DEBUG ]] ; then # rm -rf "$BACKUP_DIR"/$NAME-$VERSION-backup-$BUILD$SIG ( cd "$BACKUP_DIR" && rm -rf "$BACKUP_DIR_NAME" ) fi else echo $CYAN" Notice - "$NORMAL"Backup file restoration "$RED"Failed!"$NORMAL echo " Backup files are preserved in BACKUP_DIR/$NAME-$VERSION-backup-$BUILD$SIG" fi fi fi unset INSTW_LOGFILE rm -f $CWD/FILELIST.tmp } ## User cancelled at a 'sensitive' spot, so scold them! trap_int() { echo echo $RED"*** OUCH!!! ***"$NORMAL emergency_restore FAILED="CANCELLED" case $AUDIO_NOTIFICATION in BEEP) echo -ne '\a';sleep .5;echo -ne '\a' ;; SAY) case $TTS_ENGINE in flite) flite "Dangerous cancellation" 2> /dev/null ;; festival) echo "Dangerous cancellation" |festival --tts 2> /dev/null ;; esac ;; PLAY) play /usr/share/src2pkg/sounds/ouch &> /dev/null ;; esac exit 2 } make_simple_desc() { echo $BLUE"Creating new.$PKG_DESC file - "$NORMAL echo "Edit, if needed and rename to $PKG_DESC for use." cat /dev/null > "$CWD"/new.$PKG_DESC # Align the text formatting guide starting at ':' (plus one space) namelen=${#NAME} offset=$(( $namelen + 1 )) spaces=0 echo -n '#' >> "$CWD"/new.$PKG_DESC while [[ $spaces -lt $offset ]] ; do echo -n ' ' >> "$CWD"/new.$PKG_DESC (( spaces++ )) done # create a header for the file with a guide for formatting the text # HANDY_RULER_TEXT="|-------------Use this guide to format your text with--------------|" header_len=${#HANDY_RULER_TEXT} padding_len=$(( $DESC_WRAP_LENGTH - $header_len )) leading_pad=$(( $padding_len / 2 )) trailing_pad=$(( $padding_len - $leading_pad )) echo -n '|' >> "$CWD"/new.$PKG_DESC chars=1 while [[ $chars -lt $leading_pad ]] ; do echo -n '-' >> "$CWD"/new.$PKG_DESC chars=$(( $chars + 1 )) done echo -n $HANDY_RULER_TEXT >> "$CWD"/new.$PKG_DESC chars=1 while [[ $chars -lt $trailing_pad ]] ; do echo -n '-' >> "$CWD"/new.$PKG_DESC chars=$(( $chars + 1 )) done echo '|' >> "$CWD"/new.$PKG_DESC cat >> "$CWD"/new.$PKG_DESC << END $NAME: $BLURB_1 $NAME: $BLURB_2 $NAME: $BLURB_3 $NAME: $BLURB_4 $NAME: $BLURB_5 $NAME: $BLURB_6 $NAME: $BLURB_7 $NAME: $BLURB_8 $NAME: $BLURB_9 $NAME: $BLURB_10 $NAME: $BLURB_11 END if [[ $BLURB_12 ]] ; then echo $NAME: ${BLURB_12} >> "$CWD"/new.$PKG_DESC fi if [[ $BLURB_13 ]] ; then echo $NAME: ${BLURB_13} >> "$CWD"/new.$PKG_DESC fi } write_src2pkg_script() { echo $BLUE"Writing build script - "$NORMAL"$NAME.src2pkg.auto in the current directory." # src2pkg.auto echo "#!/bin/bash" > "$CWD"/$NAME.src2pkg.auto echo "## src2pkg script for: $NAME" >> "$CWD"/$NAME.src2pkg.auto echo "## Auto-generated by src2pkg-$SRC2PKG_VERSION" >> "$CWD"/$NAME.src2pkg.auto echo "## src2pkg - Copyright 2005-2009 Gilbert Ashley " >> "$CWD"/$NAME.src2pkg.auto #echo "## Full package name: $SHORT_NAME.tgz" >> $CWD/$NAME.src2pkg.auto echo "" >> "$CWD"/$NAME.src2pkg.auto if [[ "$SOURCE_URL" ]] ; then echo "SOURCE_URL='$SOURCE_URL'" >> "$CWD"/$NAME.src2pkg.auto echo "# SOURCE_NAME='$SOURCE_NAME'" >> "$CWD"/$NAME.src2pkg.auto elif [[ "$SOURCE_NAME" ]] ; then echo "SOURCE_NAME='$SOURCE_NAME'" >> "$CWD"/$NAME.src2pkg.auto fi if [[ "$ALT_NAME" != "" ]] ;then echo "ALT_NAME='$ALT_NAME'" >> "$CWD"/$NAME.src2pkg.auto else echo "NAME='$NAME' # Use ALT_NAME to override guessed value" >> "$CWD"/$NAME.src2pkg.auto fi if [[ "$ALT_VERSION" != "" ]] ;then echo "ALT_VERSION='$ALT_VERSION'" >> "$CWD"/$NAME.src2pkg.auto else echo "VERSION='$VERSION' # Use ALT_VERSION to override guessed value" >> "$CWD"/$NAME.src2pkg.auto fi [[ $SRC_SUFFIX ]] && echo "SRC_SUFFIX='$SRC_SUFFIX'" >> "$CWD"/$NAME.src2pkg.auto #echo "# ARCH='$ARCH'" >> "$CWD"/$NAME.src2pkg.auto if [[ "$ARCH" = 'noarch' ]] ; then echo "ARCH='noarch'" >> "$CWD"/$NAME.src2pkg.auto else echo "# ARCH=''" >> "$CWD"/$NAME.src2pkg.auto fi if [[ "$BUILD" = "1" ]] ; then echo "# BUILD='$BUILD'" >> "$CWD"/$NAME.src2pkg.auto else echo "BUILD='$BUILD'" >> "$CWD"/$NAME.src2pkg.auto fi if [[ "$WRITE_MACHINE_FLAGS" = "1" ]] ; then echo "MACHINE=\"${MACHINE}\"" >> "$CWD"/$NAME.src2pkg.auto fi if [[ "$WRITE_LIBDIRSUFFIX" = "1" ]] ; then echo "LIBDIRSUFFIX=\"$LIBDIRSUFFIX\"" >> "$CWD"/$NAME.src2pkg.auto fi # echo BUILD='${BUILD:-'$BUILD'}' >> "$CWD"/$NAME.src2pkg.auto echo "# PRE_FIX='$PRE_FIX'" >> "$CWD"/$NAME.src2pkg.auto echo "# Any extra options go here:" >> "$CWD"/$NAME.src2pkg.auto #[[ "$STD_CONFIGS" != "" ]] && echo "STD_CONFIGS='$STD_CONFIGS'" >> "$CWD"/$NAME.src2pkg.auto [[ $WRITE_CONFIG_COMMAND ]] && echo "CONFIG_COMMAND='$CONFIG_COMMAND'" >> "$CWD"/$NAME.src2pkg.auto if [[ "$EXTRA_CONFIGS" != "" ]] ; then echo "EXTRA_CONFIGS=\"${EXTRA_CONFIGS}\"" >> "$CWD"/$NAME.src2pkg.auto else echo "# EXTRA_CONFIGS=\"${EXTRA_CONFIGS}\"" >> "$CWD"/$NAME.src2pkg.auto fi #if [[ $WRITE_FLAGS ]] ; then # echo "STD_FLAGS='$STD_FLAGS'" >> "$CWD"/$NAME.src2pkg.auto #else # echo "# STD_FLAGS='$STD_FLAGS'" >> "$CWD"/$NAME.src2pkg.auto #fi [[ $WRITE_INSTALL_TYPE ]] && echo "INSTALL_TYPE='$INSTALL_TYPE'" >> "$CWD"/$NAME.src2pkg.auto [[ $SHELL_INSTALL ]] && echo "SHELL_INSTALL='YES'" >> "$CWD"/$NAME.src2pkg.auto if [[ $NEW_BUILD ]] || [[ $CONVERT_SCRIPT = 1 ]] ; then [[ $AUTO_PATCH != "NO" ]] && get_patch_list fi [[ "$PATCHLIST" != "" ]] && echo "PATCHLIST='${PATCHLIST}'" >> "$CWD"/$NAME.src2pkg.auto [ "$MAKEFILE" != "" -a "$MAKEFILE" != "Makefile" ] && echo "MAKEFILE='$MAKEFILE'" >> "$CWD"/$NAME.src2pkg.auto [ "$MAKE_COMMAND" != "" -a "$MAKE_COMMAND" != "make" ] && echo "MAKE_COMMAND='$MAKE_COMMAND'" >> "$CWD"/$NAME.src2pkg.auto [ "$INSTALL_LINE" != "" -a "$INSTALL_LINE" != "make install" ] && echo "INSTALL_LINE='$INSTALL_LINE'" >> "$CWD"/$NAME.src2pkg.auto if [[ $FUNNY_SUBDIR ]] ; then echo "CONFIG_SUBDIR='$FUNNY_SUBDIR'" >> "$CWD"/$NAME.src2pkg.auto elif [[ $CONFIG_SUBDIR ]] && [[ $NEW_BUILD ]] ; then echo "CONFIG_SUBDIR='$CONFIG_SUBDIR'" >> "$CWD"/$NAME.src2pkg.auto fi [[ "$DOCLIST" ]] && echo "DOCLIST='$DOCLIST'" >> "$CWD"/$NAME.src2pkg.auto [[ "$USE_OBJ_DIR" = "YES" ]] && echo "USE_OBJ_DIR='YES'" >> "$CWD"/$NAME.src2pkg.auto [[ $AUTO_PATCH = "NO" ]] && echo "AUTO_PATCH='NO'" >> "$CWD"/$NAME.src2pkg.auto [[ $CORRECT_PERMS = "NO" ]] && echo "CORRECT_PERMS='NO'" >> "$CWD"/$NAME.src2pkg.auto [[ $EXTRA_SOURCES ]] && echo "EXTRA_SOURCES='$EXTRA_SOURCES'" >> "$CWD"/$NAME.src2pkg.auto echo "" >> "$CWD"/$NAME.src2pkg.auto echo "# Optional function replaces configure_source, compile_source, fake_install" >> "$CWD"/$NAME.src2pkg.auto echo "# To use, uncomment and write/paste CODE between the {} brackets." >> "$CWD"/$NAME.src2pkg.auto echo "# build() { CODE }" >> "$CWD"/$NAME.src2pkg.auto echo "" >> "$CWD"/$NAME.src2pkg.auto echo "# Get the functions and configs" >> "$CWD"/$NAME.src2pkg.auto echo ". /usr/libexec/src2pkg/FUNCTIONS ;" >> "$CWD"/$NAME.src2pkg.auto echo "" >> "$CWD"/$NAME.src2pkg.auto echo "# Execute the named packaging steps:" >> "$CWD"/$NAME.src2pkg.auto #echo "" >> "$CWD"/$NAME.src2pkg.auto cat >> "$CWD"/$NAME.src2pkg.auto << EOF pre_process find_source make_dirs unpack_source fix_source_perms configure_source # compile_source # If used, the 'build' function replaces these 3 fake_install # fix_pkg_perms strip_bins create_docs compress_man_pages make_description make_doinst make_package post_process EOF echo "" >> "$CWD"/$NAME.src2pkg.auto # echo "# src2pkg - Copyright 2005-2009 Gilbert Ashley " >> "$CWD"/$NAME.src2pkg.auto echo "## See the documentation for more help and examples. Below are some of" >> "$CWD"/$NAME.src2pkg.auto echo "# the most common Extras and Options for easy cut-and-paste use." >> "$CWD"/$NAME.src2pkg.auto echo "# DOCLIST='' PATCHLIST='' INSTALL_TYPE=''" >> "$CWD"/$NAME.src2pkg.auto echo "# CONFIG_COMMAND='' MAKE_COMMAND='' INSTALL_LINE='' " >> "$CWD"/$NAME.src2pkg.auto #echo "# SHELL_INSTALL='YES' CORRECT_PERMS='NO'" >> "$CWD"/$NAME.src2pkg.auto echo "# When editing src2pkg scripts to add custom code, use these variables" >> "$CWD"/$NAME.src2pkg.auto echo "# to refer to the current directory, the sources or the package tree:" >> "$CWD"/$NAME.src2pkg.auto echo "# \$CWD (current directory), \$SRC_DIR (sources), \$PKG_DIR (package tree)" >> "$CWD"/$NAME.src2pkg.auto echo "# Other commonly-used directories include: \$DOC_DIR (document directory)" >> "$CWD"/$NAME.src2pkg.auto echo "# \$MAN_DIR (man-page directory) \$DATA_DIR (shared-data directory)" >> "$CWD"/$NAME.src2pkg.auto #echo "" >> "$CWD"/$NAME.src2pkg.auto } unset_vars() { # this function 'blanks' (unsets) most of the common src2pkg # internal variables which get derived when pre_process is run [[ $DEBUG ]] && echo "Resetting variables...!!!" BIN_DIR='' SBIN_DIR='' LIBEXEC_DIR='' SYSCONF_DIR='' SHAREDSTATE_DIR='' LOCALSTATE_DIR='' LIB_DIR='' INCLUDE_DIR='' DATA_DIR='' INFO_DIR='' LOCALE_DIR='' MAN_DIR='' DOC_DIR='' GAMESBIN_DIR='' GAMESDATA_DIR='' PIXMAPS_DIR='' ICONS_DIR='' # these are the obvious ones that need to be reset SOURCE_URL='' SOURCE_NAME='' SOURCE='' NAME='' VERSION='' ALT_NAME='' ALT_VERSION='' ORIG_NAME='' ORIG_VERSION='' SRC_DIR='' SRC_DIR_NAME='' PKG_DIR='' PKG_DIR_NAME='' OBJ_DIR='' OBJ_DIR_NAME='' # these get set later, in configure_source CONFIG_DIR='' CONFIG_SUBDIR='' CONFIG_COMMAND='' MAKE_COMMAND='' VERIFY='' }