--- checkinstall.orig 2012-08-10 23:52:01.200351720 +0200 +++ checkinstall 2012-08-11 00:06:04.563351783 +0200 @@ -468,10 +468,10 @@ function copy_dir_hierarchy { if [ $? -eq 0 ]; then if [ deref_parents -eq 1 ]; then # Add the -h option to the tar command for dereferencing - $TAR --no-recursion -C "${root}" -cphf - $files | $TAR -f - -xvpC \ + $TAR --no-recursion -C "${root}" -cphf - $files | $TAR -f - -xvpPC \ "${dest}" else - $TAR --no-recursion -C "${root}" -cpf - $files | $TAR -f - -xvpC \ + $TAR --no-recursion -C "${root}" -cpf - $files | $TAR -f - -xvpPC \ "${dest}" fi @@ -492,7 +492,7 @@ function copy_dir_hierarchy { ckversion echo -CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/checkinstallrc} +CHECKINSTALLRC=${CHECKINSTALLRC:-/usr/local/lib/checkinstall/checkinstallrc} if ! [ -f $CHECKINSTALLRC ]; then echog "The checkinstallrc file was not found at:\n$CHECKINSTALLRC" echo @@ -1548,7 +1548,7 @@ if [ $SHOW_INSTALL -eq 0 ]; then $INSTALLWATCH --logfile=${TMP_DIR}/newfiles.tmp --exclude="${IEXCLUDE}" \ --root=${TMP_DIR} --transl=${TRANSLATE} --backup=${BACKUP} --dbglvl=$DEBUG\ - $TMP_SCRIPT &> /${TMP_DIR}/install.log + $TMP_SCRIPT &> ${TMP_DIR}/install.log okfail INSTALL_FAILED=$? @@ -1586,7 +1586,7 @@ if [ $SHOW_INSTALL -eq 0 ]; then (echo echogn ' ***************************************************************\n Installation results. You can find them in\n %s\n ***************************************************************\n' "${TMP_DIR}/install.log" - cat /${TMP_DIR}/install.log) | $PAGER + cat ${TMP_DIR}/install.log) | $PAGER fi fi @@ -1635,30 +1635,30 @@ if [ $INSTALL_FAILED -gt 0 ]; then # Find regular files first [ $DEBUG -gt 0 ] && echo "debug: BASE_TMP_DIR: $BASE_TMP_DIR" - cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 3 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | sort -u > /${TMP_DIR}/newfiles + cat ${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 3 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | sort -u > ${TMP_DIR}/newfiles # symlinks are next - cat /${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 4 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | grep -v "#success" | sort -u >> /${TMP_DIR}/newfiles + cat ${TMP_DIR}/newfiles.tmp | egrep -v '^[-0-9][0-9]*[[:space:]]*(unlink|access)' | cut -f 4 | egrep -v "^(/dev|$BASE_TMP_DIR|/tmp)" | grep -v "#success" | sort -u >> ${TMP_DIR}/newfiles # Create another list of modified files that exclude all files the # install script wanted to create but did not, e.g because they already # existed. - egrep "#success$" /${TMP_DIR}/newfiles.tmp | cut -f 3 | sort -u \ - >/${TMP_DIR}/modified - egrep "#success$" /${TMP_DIR}/newfiles.tmp | cut -f 4 \ - | egrep -v "#success" | sort -u >> /${TMP_DIR}/modified + egrep "#success$" ${TMP_DIR}/newfiles.tmp | cut -f 3 | sort -u \ + >${TMP_DIR}/modified + egrep "#success$" ${TMP_DIR}/newfiles.tmp | cut -f 4 \ + | egrep -v "#success" | sort -u >> ${TMP_DIR}/modified # OK, now we clean it up a bit - mv /${TMP_DIR}/newfiles.tmp /${TMP_DIR}/newfiles.installwatch - sort -u < /${TMP_DIR}/newfiles | uniq | while read file; do + mv ${TMP_DIR}/newfiles.tmp ${TMP_DIR}/newfiles.installwatch + sort -u < ${TMP_DIR}/newfiles | uniq | while read file; do if [ -e "${TRANSLROOT}${file}" ]; then - echo $file >> /${TMP_DIR}/newfiles.tmp + echo $file >> ${TMP_DIR}/newfiles.tmp else FILE_SYM=`file "${TRANSLROOT}${file}" | grep 'symbolic link'` - [ "${FILE_SYM}" != "" ] && echo $file >> /${TMP_DIR}/newfiles.tmp + [ "${FILE_SYM}" != "" ] && echo $file >> ${TMP_DIR}/newfiles.tmp fi done - cp /${TMP_DIR}/newfiles.tmp /${TMP_DIR}/newfiles + cp ${TMP_DIR}/newfiles.tmp ${TMP_DIR}/newfiles # Don't include anything under the directories specified with "--exclude" @@ -1666,17 +1666,17 @@ if [ $INSTALL_FAILED -gt 0 ]; then for exclude in `echo $EXCLUDE | awk '{ split ($0, files,","); for(i=1; files[i] != ""; i++) print files[i];}'`; do if [ -d $exclude ]; then # If it's a directory, ignore everything below it - egrep -v "^$exclude" < /${TMP_DIR}/newfiles > /${TMP_DIR}/newfiles.tmp + egrep -v "^$exclude" < ${TMP_DIR}/newfiles > ${TMP_DIR}/newfiles.tmp else if [ -f $exclude ]; then # If it's a file, ignore just this one - egrep -v "^$exclude$" < /${TMP_DIR}/newfiles > /${TMP_DIR}/newfiles.tmp + egrep -v "^$exclude$" < ${TMP_DIR}/newfiles > ${TMP_DIR}/newfiles.tmp fi fi - cp /${TMP_DIR}/newfiles.tmp /${TMP_DIR}/newfiles + cp ${TMP_DIR}/newfiles.tmp ${TMP_DIR}/newfiles done # Find files created under /home - grep '^/home' ${TMP_DIR}/newfiles > /${TMP_DIR}/unwanted + grep '^/home' ${TMP_DIR}/newfiles > ${TMP_DIR}/unwanted if [ $? -eq 0 ]; then echo echog "Some of the files created by the installation are inside the home directory: /home" @@ -1694,7 +1694,7 @@ if [ $INSTALL_FAILED -gt 0 ]; then ## Find any files created in `pwd`. We probably don't want them here - grep "^`pwd`" ${TMP_DIR}/newfiles > /${TMP_DIR}/unwanted + grep "^`pwd`" ${TMP_DIR}/newfiles > ${TMP_DIR}/unwanted if [ $? = 0 ]; then echo echog "Some of the files created by the installation are inside the build\ndirectory: %s" "`pwd`" @@ -1705,8 +1705,8 @@ if [ $INSTALL_FAILED -gt 0 ]; then fi echogn "Should I exclude them from the package? (Saying yes is a good idea) " if yorn ; then - grep -v "`pwd`" ${TMP_DIR}/newfiles > /${TMP_DIR}/newfiles.tmp - mv /${TMP_DIR}/newfiles.tmp /${TMP_DIR}/newfiles + grep -v "`pwd`" ${TMP_DIR}/newfiles > ${TMP_DIR}/newfiles.tmp + mv ${TMP_DIR}/newfiles.tmp ${TMP_DIR}/newfiles fi fi @@ -1720,9 +1720,9 @@ if [ $INSTALL_FAILED -gt 0 ]; then $VISUAL ${TMP_DIR}/newfiles # Check if new files were added by the user - cat /${TMP_DIR}/newfiles | while read file; do + cat ${TMP_DIR}/newfiles | while read file; do if ! [ -e "${TRANSLROOT}${file}" ]; then - copy_dir_hierarchy --deref-parents "${file}" "/" "${BUILD_DIR}" >> /${TMP_DIR}/updated-by-user.log 2>&1 + copy_dir_hierarchy --deref-parents "${file}" "/" "${BUILD_DIR}" >> ${TMP_DIR}/updated-by-user.log 2>&1 fi done @@ -1737,11 +1737,11 @@ if [ $INSTALL_FAILED -gt 0 ]; then cd / - ( cat /${TMP_DIR}/newfiles | while read i; do + ( cat ${TMP_DIR}/newfiles | while read i; do if [ ! -d "${TRANSLROOT}${i}" -o -L "${TRANSLROOT}${i}" ]; then echo ".${i}" fi - done ) > /${TMP_DIR}/newfiles-tar + done ) > ${TMP_DIR}/newfiles-tar # Here it gets tricky: we need to copy all new files to our build dir, # keeping permissions as they are for parents directories as well as for @@ -1749,9 +1749,9 @@ if [ $INSTALL_FAILED -gt 0 ]; then # dereference them only if they were not modified by the installation # script. NEWFILES="${TMP_DIR}/modified" - LOGFILE="/${TMP_DIR}/checkinstall.log" + LOGFILE="${TMP_DIR}/checkinstall.log" - cat /${TMP_DIR}/newfiles-tar | while read file; do + cat ${TMP_DIR}/newfiles-tar | while read file; do parents=`list_parents ${file} | sed s/^\.//` for p in $parents; do # We have to remove the ./ at the beginning @@ -1767,15 +1767,20 @@ if [ $INSTALL_FAILED -gt 0 ]; then | $TAR -f - -xvpC "${BUILD_DIR}" >> $LOGFILE 2>&1 fi done - truefile=`echo ${file} | sed 's/^\.//'` - # No recursion here: if $file is a directory, then the files created + echo ${file} | grep symlink > /dev/null + if [ $? -ne 0 ] ; + then truefile=`echo ${file} | sed 's/^\.//' | awk '{print $3}'` + else + truefile=`echo ${file} | sed 's/^\.//' | awk '{print $4}'` + fi + # No recursion here: if $file is a directory, then the files created # in it will follow. grep "${truefile}$" "${NEWFILES}" &>/dev/null if [ $? -eq 0 ]; then - $TAR --no-recursion -C "${TRANSLROOT}" -cpf - "$file" \ + $TAR --no-recursion -C "${TRANSLROOT}" -cpPf - "$truefile" \ | $TAR -f - -xvpC "${BUILD_DIR}" >> $LOGFILE 2>&1 else - $TAR --no-recursion -C "${TRANSLROOT}" -cphf - "$file" \ + $TAR --no-recursion -C "${TRANSLROOT}" -cphPf - "$truefile" \ | $TAR -f - -xvpC "${BUILD_DIR}" >> $LOGFILE 2>&1 fi done @@ -2279,7 +2284,7 @@ if ! [ $FAILED -gt 0 ]; then # Identify the rpm version -RPM_VERSION=`rpm --version | awk '{ print $3 }'` +RPM_VERSION=`/bin/rpm --version | sed "s/^.* \([0-9]\)/\1/"` RPM_MAJOR_VERSION=`echo $RPM_VERSION | cut -f1 -d"."` RPM_MINOR_VERSION=`echo $RPM_VERSION | cut -f2 -d"."` RPM_PATCH_LEVEL=`echo $RPM_VERSION | cut -f3 -d"."` @@ -2463,7 +2468,7 @@ cd "$DIRECTORIO_FUENTE" echo echogn "Building RPM package..." -$RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log +$RPMBUILD -bb ${RPM_TARGET_FLAG}${ARCHITECTURE} --buildroot $BROOTPATH "$SPEC_PATH" &> ${TMP_DIR}/rpmbuild.log okfail if [ $? -gt 0 ]; then