1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216 |
- #!/bin/sh
- export LANG=C
- . /etc/xdg/menus/hierarchy
- . ./DISTRO_SPECS
- [ ! "$DISTRO_DB_SUBNAME" ] && DISTRO_DB_SUBNAME="$DISTRO_COMPAT_VERSION"
- export DISTRO_BINARY_COMPAT
- export DISTRO_FILE_PREFIX
- if [ -f ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
- . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- else
- . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}
- fi
- if [ -f ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
- . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- DPSFILE="DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}"
- else
- . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}
- DPSFILE="DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}"
- fi
- . ./DISTRO_PET_REPOS
- if [ -f WOOFMERGEVARS ];then
- . ./WOOFMERGEVARS
- else
- echo 'File WOOFMERGEVARS does not exist. This is created by script
- merge2out. Your setup is wrong, quiting.'
- exit
- fi
- ARCHDIR=''
- if [ "$WOOF_COMPATDISTRO" = "ubuntu" ];then
- case $WOOF_COMPATVERSION in
- jaunty|karmic|lucid)
- true
- ;;
- *)
- case $WOOF_TARGETARCH in
- x86) ARCHDIR='i386-linux-gnu' ;;
- x86_64) ARCHDIR='x86_64-linux-gnu' ;;
- esac
- ;;
- esac
- fi
- if [ "$WOOF_COMPATDISTRO" = "debian" ];then
- case $WOOF_COMPATVERSION in
- squeeze|lenny|etch|sarge|woody)
- true
- ;;
- *)
- case $WOOF_TARGETARCH in
- x86) ARCHDIR='i386-linux-gnu' ;;
- x86_64) ARCHDIR='x86_64-linux-gnu' ;;
- esac
- ;;
- esac
- fi
- if [ "$WOOF_COMPATDISTRO" = "mageia" ];then
- case $WOOF_TARGETARCH in
- x86) ARCHDIR='multiarch-i386-linux' ;;
- *) ARCHDIR=''; echo 'dunno'; exit ;;
- esac
- fi
- case $WOOF_TARGETARCH in
- arm)
- case $WOOF_COMPATDISTRO in
- raspbian) ARCHDIR='arm-linux-gnueabihf' ;;
- debian)
- case $WOOF_COMPATVERSION in
- squeeze) true ;;
- *) ARCHDIR='arm-linux-gnueabihf' ;;
- esac
- ;;
- ubuntu)
- case $WOOF_COMPATVERSION in
- jaunty|karmic|lucid) true ;;
- *) ARCHDIR='arm-linux-gnueabihf' ;;
- esac
- ;;
- esac
- ;;
- esac
- if [ "$FALLBACKS_COMPAT_VERSIONS" != "" ];then
- FALLBACKS_COMPAT_VERSIONS="`echo -n "$FALLBACKS_COMPAT_VERSIONS" | grep -o "${DISTRO_COMPAT_VERSION}.*"`"
-
- fi
- BINARIES='deb'
- [ "$DISTRO_BINARY_COMPAT" = "t2" ] && BINARIES="bz2"
- [ "$DISTRO_BINARY_COMPAT" = "slackware" ] && BINARIES="tgz_txz"
- [ "$DISTRO_BINARY_COMPAT" = "debian" ] && BINARIES="deb"
- [ "$DISTRO_BINARY_COMPAT" = "arch" ] && BINARIES="tar_xz"
- [ "$DISTRO_BINARY_COMPAT" = "puppy" ] && BINARIES="pet"
- [ "$DISTRO_BINARY_COMPAT" = "scientific" ] && BINARIES="rpm"
- [ "$DISTRO_BINARY_COMPAT" = "mageia" ] && BINARIES="rpm"
- [ "$DISTRO_BINARY_COMPAT" = "gentoo" ] && BINARIES="gentoo"
- [ "$DISTRO_BINARY_COMPAT" = "raspbian" ] && BINARIES="deb_raspbian"
- BINARIES="${BINARIES}-${DISTRO_COMPAT_VERSION}"
- echo "Preprocessing $DISTRO_BINARY_COMPAT $DISTRO_COMPAT_VERSION pkgs database..."
- PKGLISTS_COMPAT="`echo "$PKG_DOCS_DISTRO_COMPAT" | tr ' ' '\n' | cut -f 3 -d '|' | tr '\n' ' '`"
- MY_LANG='en,en_US,en_AU'
- CURRDIR="`pwd`"
- [ ! -d packages-templates ] && exit 1
- [ ! -d packages-${BINARIES} ] && exit 1
- PKGS_SPECS_TABLE="`echo "$PKGS_SPECS_TABLE" | grep -v '^#' | grep -v '^$' | tr '\t' ' ' | tr -s ' ' | tr '+' '&' | sed -e 's%|&.*%%' | tr '&' '+' | sed -e 's% #.*%%' -e 's% $%%' -e 's%$%|%' -e 's%||$%|%'`"
- echo
- echo "Checking syntax of PKGS_SPECS_TABLE..."
- CNT=1
- for ONECHK in $PKGS_SPECS_TABLE
- do
- BADFLAG='no'
- NUMDELS=`echo "$ONECHK" | sed -e 's/[^|]//g' | wc -c`
- [ $NUMDELS -lt 4 -o $NUMDELS -gt 6 ] && BADFLAG='yes'
- YESNO="`echo "$ONECHK" | cut -f 1 -d '|' | grep -E 'yes|no'`"
- [ "YESNO" = "" ] && BADFLAG='yes'
- GENPKG="`echo "$ONECHK" | cut -f 2 -d '|'`"
- [ "$GENPKG" = "" ] && BADFLAG='yes'
- if [ "$BADFLAG" = "yes" ];then
- echo "SYNTAX ERROR LINE ${CNT}: '$ONECHK'"
- echo "$PKGS_SPECS_TABLE" > /tmp/pst-dump
- exit 1
- fi
- CNT=$(($CNT + 1))
- done
- COMMANDLINE_CHOICE=""
- [ $1 ] && COMMANDLINE_CHOICE="$1"
- mkdir -p /tmp/2createpackages_tmp
- mkdir -p status
- touch status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- [ "$COMMANDLINE_CHOICE" = "ALL_PACKAGES" ] && echo -n "" > status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- mkdir -p packages-${DISTRO_FILE_PREFIX}
- while [ 1 ];do
- if [ "$COMMANDLINE_CHOICE" = "CHANGED_ONLY" ];then
- CHOICE_PKGS_SPECS_TABLE="$PKGS_SPECS_TABLE"
- break
- fi
- if [ "$COMMANDLINE_CHOICE" = "" ];then
- echo
- echo "Press ENTER only to build all pkgs,"
- echo -n " or type generic name of one pkg: "
- read USERINPUT
- else
- if [ "$COMMANDLINE_CHOICE" = "ALL_PACKAGES" ];then
- USERINPUT=""
- else
- USERINPUT="$COMMANDLINE_CHOICE"
- fi
- fi
- if [ "$USERINPUT" = "" ];then
- rm -rf packages-${DISTRO_FILE_PREFIX}
- mkdir packages-${DISTRO_FILE_PREFIX}
- CHOICE_PKGS_SPECS_TABLE="$PKGS_SPECS_TABLE"
- rm -rf sandbox2c 2>/dev/null
- else
- aPATTERN='^yes|'"$USERINPUT"'|'
- CHOICE_PKGS_SPECS_TABLE="`echo "$PKGS_SPECS_TABLE" | grep "$aPATTERN"`"
- if [ "$CHOICE_PKGS_SPECS_TABLE" = "" ];then
- echo "ERROR: Generic-name must be from 2nd field of variable PKGS_SPECS_TABLE"
- echo "in file ${DPSFILE}."
- echo "There must also be a 'yes' in the first field."
- continue
- fi
- rm -rf packages-${DISTRO_FILE_PREFIX}/$USERINPUT 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${USERINPUT}_DEV 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${USERINPUT}_DOC 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${USERINPUT}_NLS 2>/dev/null
- rm -rf sandbox2c/$USERINPUT 2>/dev/null
- fi
- break
- done
- [ -f rootfs-skeleton/usr/local/petget/categories.dat ] && cp -f rootfs-skeleton/usr/local/petget/categories.dat /usr/local/petget/
- ./support/findpkgs
- if [ $? -ne 0 ];then
- echo
- echo "ERROR: Script support/findpkgs aborted with an error, exiting."
- exit 1
- fi
- if [ ! -f status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
- echo
- echo "ERROR: Something went wrong with support/findpkgs, exiting."
- exit 1
- fi
- echo -n "" > /tmp/2createpackages-redo
- rm -f ERROR-2CREATEPACKAGES 2>/dev/null
- for ONEPKGSPEC in $CHOICE_PKGS_SPECS_TABLE
- do
- [ "$ONEPKGSPEC" = "" ] && continue
- YESNO="`echo "$ONEPKGSPEC" | cut -f 1 -d '|'`"
- [ "$YESNO" = "no" ] && continue
- MISSPOSTPROC='no'
- echo -n "$MISSPOSTPROC" > /tmp/2createpackages_tmp/MISSPOSTPROC
- GENERICNAME="`echo "$ONEPKGSPEC" | cut -f 2 -d '|'`"
- BINARYPARTNAMES="`echo "$ONEPKGSPEC" | cut -f 3 -d '|' | tr ',' ' '`"
- SPLITRULE="`echo "$ONEPKGSPEC" | cut -f 4 -d '|'`"
- echo "Processing $GENERICNAME"
- REMOVEDGENFLAG=0
- rm -f /tmp/2createpackages-hack-install.sh
- rm -rf sandbox2b
- mkdir sandbox2b
-
- gennamePTN=":${GENERICNAME}:"
- FNDIT="`grep "$gennamePTN" status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}`"
- if [ "$FNDIT" = "" ];then
- echo "
- ERROR: '${GENERICNAME}' package does not exist.
- You will need to find a matching package and place in packages-pet,
- or packages-${BINARIES} as appropriate.
- Do it, then rerun this script and choose to build $GENERICNAME." >> ERROR-2CREATEPACKAGES
- continue
- fi
-
-
- while read ONEDBENTRY
- do
-
-
-
- PETorCOMPAT="`echo -n "$ONEDBENTRY" | cut -f 2 -d '|'`"
- if [ "$PETorCOMPAT" != "pet" -a "$PETorCOMPAT" != "compat" ];then
- echo "
- Syntax ERROR in status/findpkgs_FINAL_PKGS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}:
- $ONEDBENTRY
- Ignoring this line." >> ERROR-2CREATEPACKAGES
- continue
- fi
- DBFILE="`echo -n "$ONEDBENTRY" | cut -f 3 -d '|'`"
- DB_pkgname="`echo -n "$ONEDBENTRY" | cut -f 4 -d '|'`"
- DB_fullfilename="`echo -n "$ONEDBENTRY" | cut -f 11 -d '|'`"
- petFLG="`echo -n "$DB_fullfilename" | grep -o 'pet$'`"
- echo -n "$petFLG" > /tmp/2createpackages_tmp/petFLG
-
- EXE="_`echo "$SPLITRULE" | tr ',' '\n' | grep '^exe' | cut -f 2 -d '>' | tr '[a-z]' '[A-Z]'`"
- DEV="_`echo "$SPLITRULE" | tr ',' '\n' | grep '^dev' | cut -f 2 -d '>' | tr '[a-z]' '[A-Z]'`"
- DOC="_`echo "$SPLITRULE" | tr ',' '\n' | grep '^doc' | cut -f 2 -d '>' | tr '[a-z]' '[A-Z]'`"
- NLS="_`echo "$SPLITRULE" | tr ',' '\n' | grep '^nls' | cut -f 2 -d '>' | tr '[a-z]' '[A-Z]'`"
- [ "$EXE" = "_" ] && EXE="_EXE"
- [ "$DEV" = "_" ] && DEV="_EXE"
- [ "$DOC" = "_" ] && DOC="_EXE"
- [ "$NLS" = "_" ] && NLS="_EXE"
-
- [ "$EXE" = "_EXE" ] && EXE=""
- [ "$DEV" = "_EXE" ] && DEV=""
- [ "$DOC" = "_EXE" ] && DOC=""
- [ "$NLS" = "_EXE" ] && NLS=""
- if [ "$petFLG" = "pet" ];then
- PETPKG="`basename $DB_fullfilename .pet`"
- PETSUB="pet"
- [ "$PETorCOMPAT" = "compat" ] && PETSUB="$BINARIES"
- cspPATTERN='|'"$PETPKG"'.pet$'
- if [ "$COMMANDLINE_CHOICE" = "CHANGED_ONLY" ];then
- if [ "`grep "$cspPATTERN" status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}`" != "" ];then
- echo " ...${PETPKG}.pet already processed"
- continue
- fi
- if [ $REMOVEDGENFLAG -eq 0 ];then
- rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME} 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DOC 2>/dev/null
- rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_NLS 2>/dev/null
- rm -rf sandbox2c/${GENERICNAME} 2>/dev/null
- groPATTERN='^'"$GENERICNAME"'|'
- grep -v "$groPATTERN" status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} > /tmp/2createpackages-hbdd
- mv -f /tmp/2createpackages-hbdd status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- REMOVEDGENFLAG=1
- fi
- fi
- echo "${GENERICNAME}|${PETPKG}.pet" >> status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
-
- echo " processing ${PETPKG}.pet"
-
- xPETTYPE="`echo -n "$DB_pkgname" | grep -o -E '_DEV|_DOC|_NLS'`"
- [ "$xPETTYPE" = "" ] && xxPETTYPE="$EXE"
- [ "$xPETTYPE" = "_DEV" ] && xxPETTYPE="$DEV"
- [ "$xPETTYPE" = "_DOC" ] && xxPETTYPE="$DOC"
- [ "$xPETTYPE" = "_NLS" ] && xxPETTYPE="$NLS"
-
- rm -rf sandbox2e 2>/dev/null
- mkdir sandbox2e
- if [ -f packages-${PETSUB}/${PETPKG}.pet ];then
-
-
- file -b "packages-${PETSUB}/${PETPKG}.pet" | grep -q "^xz" && ZEXT=xz || ZEXT=gz
- cp -f packages-${PETSUB}/${PETPKG}.pet sandbox2e/
- cd sandbox2e
- case $ZEXT in
- gz) opt=-z ;;
- xz) opt=-J ;;
- esac
- pet2tgz ${PETPKG}.pet
- tar ${opt} -x -f $PETPKG.tar.${ZEXT}
-
- mkdir -p ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${xxPETTYPE}
- cp -a -f --remove-destination $PETPKG/* ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${xxPETTYPE}/
- sync
- rm ${PETPKG}.tar.${ZEXT}
- rm -rf $PETPKG
- cd ..
- else
- echo "
- ERROR: packages-${PETSUB}/${PETPKG}.pet does not exist.
- (Generic name: ${GENERICNAME})
- You will need to find this PET package and place in packages-${PETSUB}.
- Do it, then rerun this script and choose to build $GENERICNAME." >> ERROR-2CREATEPACKAGES
- fi
- rm -rf sandbox2e 2>/dev/null
- continue
- fi
-
-
- ONEBINARYPKG="./packages-${BINARIES}/${DB_fullfilename}"
- if [ ! -f $ONEBINARYPKG ];then
- echo "
- ERROR: ${ONEBINARYPKG} does not exist.
- Please find a package that matches, place it in packages-${BINARIES},
- then run this script again and choose to build ${GENERICNAME}." >> ERROR-2CREATEPACKAGES
- continue 2
- fi
- zPKGNAME="$DB_fullfilename"
-
-
- cspPATTERN='|'"$zPKGNAME"'$'
- if [ "$COMMANDLINE_CHOICE" = "CHANGED_ONLY" ];then
- if [ "`grep "$cspPATTERN" status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}`" != "" ];then
- echo " ...${zPKGNAME} already processed"
- MISSPOSTPROC='yes'
- echo -n "$MISSPOSTPROC" > /tmp/2createpackages_tmp/MISSPOSTPROC
- continue
- fi
- groPATTERN='^'"$GENERICNAME"'|'
- grep -v "$groPATTERN" status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} > /tmp/2createpackages-hbdd
- mv -f /tmp/2createpackages-hbdd status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- REMOVEDGENFLAG=1
-
- echo "$GENERICNAME" >> /tmp/2createpackages-redo
- continue 2
- fi
- echo "${GENERICNAME}|${zPKGNAME}" >> status/2createpackages_history_builds-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
- echo " processing $zPKGNAME"
- case $DISTRO_BINARY_COMPAT in
- ubuntu|debian|raspbian)
- PKGNAME="`basename $ONEBINARYPKG .deb`"
- rm -rf sandbox2
- mkdir sandbox2
- dpkg-deb -x $ONEBINARYPKG sandbox2/
- if [ $? -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
- ;;
- slackware)
-
- SLACKEXT="`echo -n "$ONEBINARYPKG" | rev | cut -f 1 -d '.' | rev`"
- rm -rf sandbox2
- mkdir sandbox2
- cp -a $ONEBINARYPKG sandbox2/
- cd sandbox2
- if [ "$SLACKEXT" == "tgz" ];then
- PKGNAME="`basename ${ONEBINARYPKG} .tgz`"
- tar -izxf ${PKGNAME}.tgz
- RETVAL=$?
- rm -f ${PKGNAME}.tgz
- else
- PKGNAME="`basename ${ONEBINARYPKG} .txz`"
- tar -iJxf ${PKGNAME}.txz
- RETVAL=$?
- rm -f ${PKGNAME}.txz
- fi
- cd ..
- if [ $RETVAL -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
-
- if [ -f sandbox2/install/doinst.sh ];then
- chmod +x sandbox2/install/doinst.sh
-
-
-
- cat sandbox2/install/doinst.sh >> /tmp/2createpackages-hack-install.sh
-
-
- rm -rf sandbox2/install
- fi
- ;;
- arch)
- FULLPKGNAME="`basename $ONEBINARYPKG`"
- PKGNAME="`basename $ONEBINARYPKG .pkg.tar.gz`"
- PKGNAME="`basename $PKGNAME .pkg.tar.xz`"
- PKGNAME="`echo -n "$PKGNAME" | sed 's%\-any$%%'`"
- PKGNAME="`echo -n "$PKGNAME" | sed 's%\-i686$%%'`"
-
- rm -rf sandbox2
- mkdir sandbox2
- cp -a $ONEBINARYPKG sandbox2/
- cd sandbox2
- if [ "`basename $ONEBINARYPKG .tar.xz`" != "`basename $ONEBINARYPKG`" ]; then
- tar --force-local -Jxf $FULLPKGNAME
- else
- tar --force-local -zxf $FULLPKGNAME
- fi
- RETVAL=$?
- rm -f $FULLPKGNAME
- cd ..
- if [ $RETVAL -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
- ;;
- t2|gentoo)
- FULLPKGNAME="`basename $ONEBINARYPKG`"
- PKGNAME="`basename $ONEBINARYPKG .tar.bz2`"
- rm -rf sandbox2
- mkdir sandbox2
- cp -a $ONEBINARYPKG sandbox2/
- cd sandbox2
- tar -jxf $FULLPKGNAME
- RETVAL=$?
- rm -f $FULLPKGNAME
- cd ..
- if [ $RETVAL -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
- ;;
- scientific)
- FULLPKGNAME="`basename $ONEBINARYPKG`"
- PKGNAME="`basename $ONEBINARYPKG .rpm`"
- rm -rf sandbox2
- mkdir sandbox2
- cp -a $ONEBINARYPKG sandbox2/
- cd sandbox2
- rpm2cpio $FULLPKGNAME | cpio -id > /dev/null 2>&1
- RETVAL=$?
- rm -f $FULLPKGNAME
- cd ..
- if [ $RETVAL -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
- ;;
- mageia)
- FULLPKGNAME="`basename $ONEBINARYPKG`"
- PKGNAME="`basename $ONEBINARYPKG .rpm`"
- rm -rf sandbox2
- mkdir sandbox2
- cp -a $ONEBINARYPKG sandbox2/
- cd sandbox2
-
-
-
-
- exploderpm -x $FULLPKGNAME > /dev/null 2>&1
- RETVAL=$?
- rm -f $FULLPKGNAME
- cd ..
- if [ $RETVAL -ne 0 ];then
- echo "ERROR: failed to unpack $PKGNAME"
- continue
- fi
- ;;
- esac
-
-
-
- if [ "$ARCHDIR" ];then
- if [ -d sandbox2/lib/$ARCHDIR ];then
-
- cp -a -f --remove-destination sandbox2/lib/${ARCHDIR}/* sandbox2/lib/
- sync
- rm -rf sandbox2/lib/${ARCHDIR}
- ln -s ./ sandbox2/lib/${ARCHDIR}
-
-
-
-
-
-
- fi
- if [ -d sandbox2/usr/lib/$ARCHDIR ];then
-
- cp -a -f --remove-destination sandbox2/usr/lib/${ARCHDIR}/* sandbox2/usr/lib/
- sync
- rm -rf sandbox2/usr/lib/${ARCHDIR}
- ln -s ./ sandbox2/usr/lib/${ARCHDIR}
-
-
-
-
-
-
- fi
-
- if [ -d sandbox2/usr/bin/$ARCHDIR ];then
- cp -a -f --remove-destination sandbox2/usr/bin/${ARCHDIR}/* sandbox2/usr/bin/
- sync
- rm -rf sandbox2/usr/bin/${ARCHDIR}
- ln -s ./ sandbox2/usr/bin/${ARCHDIR}
- fi
- fi
-
-
- DEFICON='Executable.xpm'
- FULLPKGNAME="`basename $ONEBINARYPKG`"
- DB_ENTRY="`echo -n "$ONEDBENTRY" | cut -f 4-19 -d '|'`"
-
-
- CATEGORY="`echo -n "$DB_ENTRY" | cut -f 5 -d '|'`"
- [ "$CATEGORY" = "" ] && CATEGORY='BuildingBlock'
-
- xCATEGORY="`echo -n "$CATEGORY" | sed -e 's%^%X-%' -e 's%;%-%'`"
- DEFICON="`echo -n "$CATEGORY" | sed -e 's%^%mini-%' -e 's%;%-%'`"
- case $CATEGORY in
- Calculate) CATEGORY='Business' ; xCATEGORY='X-Business' ; DEFICON='mini-Business.xpm' ;;
- Develop) CATEGORY='Utility;development' ; xCATEGORY='X-Utility-development' ; DEFICON='mini-Utility-development.xpm' ;;
- Help) CATEGORY='Utility;help' ; xCATEGORY='X-Utility-help' ; DEFICON='mini-Help.xpm' ;;
- BuildingBlock) CATEGORY='Utility' ; xCATEGORY='X-Utility' ; DEFICON='mini-BuildingBlock.xpm' ;;
- esac
-
- topCATEGORY="`echo -n "$CATEGORY" | cut -f 1 -d ';'`"
- tPATTERN="^${topCATEGORY} "
- cPATTERN="s%^Categories=.*%Categories=${xCATEGORY}%"
- iPATTERN="s%^Icon=.*%Icon=${DEFICON}%"
- FND_DESKTOP="`find sandbox2/usr/share/applications sandbox2/usr/local/share/applications sandbox2/usr/X11R7/applications -type f -name \*.desktop 2>/dev/null | tr '\n' ' '`"
-
-
- CATDONE='no'
- if [ -f /usr/local/petget/categories.dat ];then
- NUMDESKFILE="$(echo -n "$FND_DESKTOP" | wc -w)"
- if [ "$NUMDESKFILE" = "1" ];then
-
-
- DBNAMEONLY="$(echo -n "$DB_ENTRY" | cut -f 2 -d '|')"
- DBPATH="$(echo -n "$DB_ENTRY" | cut -f 7 -d '|')"
- DBCOMPILEDDISTRO="$(echo -n "$DB_ENTRY" | cut -f 11 -d '|')"
- [ ! "$DBCOMPILEDDISTRO" ] && DBCOMPILEDDISTRO='puppy'
- case $DBCOMPILEDDISTRO in
- debian|ubuntu|raspbian)
- if [ "$DBPATH" ];then
- xNAMEONLY="$(basename ${DBPATH})"
- else
- xNAMEONLY="$DBNAMEONLY"
- fi
- ;;
- *) xNAMEONLY="$DBNAMEONLY" ;;
- esac
- xnPTN=" ${xNAMEONLY} "
-
- CATVARIABLE="$(grep -i "$xnPTN" /usr/local/petget/categories.dat | grep '^PKGCAT' | head -n 1 | cut -f 1 -d '=' | cut -f 2,3 -d '_' | tr '_' '-')"
- if [ "$CATVARIABLE" ];then
- xCATEGORY="X-${CATVARIABLE}"
- cPATTERN="s%^Categories=.*%Categories=${xCATEGORY}%"
- CATFOUND="yes"
- CATDONE='yes'
- fi
- fi
- fi
-
- for ONEDESKTOP in $FND_DESKTOP
- do
- CATFOUND="no"
- if [ "$CATDONE" = "no" ];then
- for ONEORIGCAT in `cat $ONEDESKTOP | grep '^Categories=' | head -n 1 | cut -f 2 -d '=' | tr ';' ' ' | rev`
- do
-
- ONEORIGCAT="`echo -n "$ONEORIGCAT" | rev`"
- oocPATTERN=' '"$ONEORIGCAT"' '
- [ "`echo "$PUPHIERARCHY" | tr -s ' ' | grep "$tPATTERN" | cut -f 3 -d ' ' | tr ',' ' ' | sed -e 's%^% %' -e 's%$% %' | grep "$oocPATTERN"`" != "" ] && CATFOUND="yes"
-
- if [ "$CATFOUND" = "yes" ];then
- cPATTERN="s%^Categories=.*%Categories=${ONEORIGCAT}%"
- break
- fi
- done
-
- if [ "$CATFOUND" = "no" ];then
- for ONEORIGCAT in `cat $ONEDESKTOP | grep '^Categories=' | head -n 1 | cut -f 2 -d '=' | tr ';' ' ' | rev`
- do
-
- ONEORIGCAT="`echo -n "$ONEORIGCAT" | rev`"
- oocPATTERN=' '"$ONEORIGCAT"' '
- [ "`echo "$PUPHIERARCHY" | tr -s ' ' | cut -f 3 -d ' ' | tr ',' ' ' | sed -e 's%^% %' -e 's%$% %' | grep "$oocPATTERN"`" != "" ] && CATFOUND="yes"
-
- if [ "$CATFOUND" = "yes" ];then
- cPATTERN="s%^Categories=.*%Categories=${ONEORIGCAT}%"
- break
- fi
- done
- fi
- fi
-
- sed -i -e "$cPATTERN" $ONEDESKTOP
-
- ICON="`grep '^Icon=' $ONEDESKTOP | cut -f 2 -d '='`"
- if [ "$ICON" != "" ];then
- [ -e "sandbox2${ICON}" ] && continue
- [ -e "${ICON}" ] && continue
- ICONBASE="`basename "$ICON"`"
-
- FNDICON=""
- [ -d sandbox2/usr/share/pixmaps ] && FNDICON="`find sandbox2/usr/share/pixmaps -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
- [ ! "$FNDICON" ] && [ -d sandbox2/usr/local/lib/X11/mini-icons ] && FNDICON="`find sandbox2/usr/local/lib/X11/mini-icons -maxdepth 1 -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
- if [ "$FNDICON" ];then
- ICONNAMEONLY="`basename $FNDICON`"
- iPTN="s%^Icon=.*%Icon=${ICONNAMEONLY}%"
- sed -i -e "$iPTN" $ONEDESKTOP
- continue
- else
-
- FNDICON="`find sandbox2 /usr/share/icons /usr/local/share/pixmaps /usr/share/pixmaps -name $ICONBASE -o -name $ICONBASE.png -o -name $ICONBASE.xpm -o -name $ICONBASE.jpg -o -name $ICONBASE.jpeg -o -name $ICONBASE.gif -o -name $ICONBASE.svg | sed -e 's%sandbox2%%' | grep -i -E 'png$|xpm$|jpg$|jpeg$|gif$|svg$' | head -n 1`"
- if [ "$FNDICON" ];then
- ICONNAMEONLY="`basename "$FNDICON"`"
- mkdir -p sandbox2/usr/share/pixmaps
- ln -snf "$FNDICON" sandbox2/usr/share/pixmaps/${ICONNAMEONLY}
- iPTN="s%^Icon=.*%Icon=${ICONNAMEONLY}%"
- sed -i -e "$iPTN" $ONEDESKTOP
- continue
- fi
- fi
-
- sed -i -e "$iPATTERN" $ONEDESKTOP
- fi
- done
-
- [ -d sandbox2/var/adm ] && rm -rf sandbox2/var/adm
-
- [ -d sandbox2/etc/postinstall.d ] && rm -rf sandbox2/etc/postinstall.d
- [ -d sandbox2/etc/stone.d ] && rm -rf sandbox2/etc/stone.d
-
- cp -a --remove-destination sandbox2/* sandbox2b/
-
- if [ "`echo "$PKGNAME" | grep -E '\-dev_|_DEV'`" != "" ];then
- mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}
- cp -a --remove-destination sandbox2/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/
- continue
- fi
-
- if [ "`echo "$PKGNAME" | grep -E '\-doc_|_DOC'`" != "" ];then
- mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DOC}
- cp -a --remove-destination sandbox2/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DOC}/
- continue
- fi
-
- if [ "`echo "$PKGNAME" | grep '_NLS'`" != "" ];then
- mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${NLS}
- cp -a --remove-destination sandbox2/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${NLS}/
- continue
- fi
-
- cd sandbox2
-
-
- find -L ./ -noleaf -type f | sed -e 's/^\.\///' |
- while read ONEFILE
- do
-
- UPONE="`dirname "$ONEFILE"`"
- while [ "$UPONE" != "." -a "$UPONE" != "/" ];do
- [ -h "$UPONE" ] && continue 2
- UPONE="`dirname "$UPONE"`"
- done
- ONEBASE="`basename "$ONEFILE"`"
- ONEPATH="`dirname "$ONEFILE"`"
- [ "$ONEPATH" = "." ] && ONEPATH=""
-
-
- if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then
- if [ "`which strip`" != "" ];then
- if [ ! -h "$ONEFILE" ];then
- [ ! "`file "$ONEFILE" | grep 'ELF' | grep 'shared object'`" = "" ] && strip --strip-debug "$ONEFILE"
- [ ! "`file "$ONEFILE" | grep 'ELF' | grep 'executable'`" = "" ] && strip --strip-unneeded "$ONEFILE"
- fi
- fi
- fi
- sync
-
-
- if [ ! "`echo -n "$ONEFILE" | grep --extended-regexp '/locale/|/nls/|/i18n/'`" = "" ];then
- if [ "`echo -n "$ONEFILE" | grep 'share/X11/locale/'`" = "" ];then
- [ "$NLS" = "_NULL" ] && continue
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${NLS}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${NLS}/${ONEPATH}/" 2>/dev/null
- continue
- fi
- fi
-
-
- if [ ! "`echo -n "$ONEFILE" | grep --extended-regexp '/man/|/doc/|/doc-base/|/docs/|/info/|/gtk-doc/|/faq/|/manual/|/examples/|/help/|/htdocs/'`" = "" ];then
- [ "$DOC" = "_NULL" ] && continue
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DOC}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DOC}/${ONEPATH}/" 2>/dev/null
- continue
- fi
-
-
- if [ ! "`echo -n "$ONEFILE" | grep --extended-regexp 'X11/config/|/include/|/pkgconfig/|/aclocal|/cvs/|/svn/'`" = "" ];then
-
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}/" 2>/dev/null
- continue
- fi
-
- if [ -h "$ONEFILE" ];then
- if [ ! "`echo -n "$ONEFILE" | grep '\.so$'`" = "" ];then
-
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}/" 2>/dev/null
- continue
- fi
- fi
-
- if [ ! "`echo -n "$ONEBASE" | grep --extended-regexp '\-config$|config.sh$|Conf.sh$'`" = "" ];then
-
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}/" 2>/dev/null
- continue
- fi
-
- if [ ! "`echo -n "$ONEBASE" | grep --extended-regexp '\.a$|\.la$|\.m4$'`" = "" ];then
-
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONEPATH}/" 2>/dev/null
- continue
- fi
-
-
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${ONEPATH}"
- cp -af "$ONEFILE" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${ONEPATH}/" 2>/dev/null
- done
-
-
- find -L ./ -noleaf -type d | sed -e 's/^\.\///' |
- while read ANEWDIR
- do
- UPONE="`dirname "$ANEWDIR"`"
- [ "$UPONE" = "." ] && UPONE=""
- if [ -h "$ANEWDIR" ];then
- mkdir -p "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${UPONE}"
- cp -af "$ANEWDIR" "../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${UPONE}/"
- continue
- fi
-
- [ "`ls -1 $ANEWDIR`" = "" ] && mkdir -p ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${ANEWDIR}
- done
- cd ..
-
- done<<_END1
- $(echo "${FNDIT}")
- _END1
-
-
- [ "`cat /tmp/2createpackages_tmp/petFLG`" = "pet" ] && continue
- [ "`cat /tmp/2createpackages_tmp/MISSPOSTPROC`" = "yes" ] && continue
-
-
-
-
-
-
- if [ -f packages-templates/$GENERICNAME/FIXUPHACK ];then
-
- DPISFLAG="`grep '^DISABLE_POST_INSTALL_SCRIPT' packages-templates/$GENERICNAME/FIXUPHACK | grep 'yes'`"
- [ "$DPISFLAG" ] && [ -f /tmp/2createpackages-hack-install.sh ] && rm -f /tmp/2createpackages-hack-install.sh
- fi
-
-
-
- [ -f /tmp/2createpackages-hack-install.sh ] && mv -f /tmp/2createpackages-hack-install.sh sandbox2b/hack-install.sh
- if [ -f sandbox2b/hack-install.sh ];then
- echo " executing (Slackware) post-install script"
-
-
- [ -f /sbin/ldconfig ] && mv -f /sbin/ldconfig /sbin/ldconfig-2cp-hidden
- [ -f /usr/sbin/chroot ] && mv -f /usr/sbin/chroot /usr/sbin/chroot-2cp-hidden
- [ -f sandbox2b/sbin/ldconfig ] && mv -f sandbox2b/sbin/ldconfig /tmp/ldconfig-hidden2
- mkdir -p sandbox2b/bin
- mkdir layer_rw
- mkdir layer_top
- mount -t tmpfs tmpfs layer_rw
- LAYERFS="aufs"
- [ "`lsmod | grep '^unionfs'`" != "" ] && LAYERFS="unionfs"
- if [ "$LAYERFS" = "aufs" ];then
- mount -t aufs -o udba=reval,diropq=w,dirs=layer_rw=rw:sandbox2b=ro layerfs layer_top
- else
- mount -t unionfs -o dirs=layer_rw=rw:sandbox2b=ro layerfs layer_top
- fi
- cd layer_top
- /bin/sh ./hack-install.sh
- cd ..
- [ ! -d packages-${DISTRO_FILE_PREFIX}/${GENERICNAME} ] && mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}
- cp -a --remove-destination layer_rw/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}/ 2>/dev/null
-
- find layer_rw -type f -name .wh.* | grep -v '\.wh\.\.wh' | sed -e 's%\.wh\.%%' | sed -e 's%layer_rw%%' |
- while read ONEFILE
- do
- rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${ONEFILE} 2>/dev/null
- [ -d packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV ] && rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV${ONEFILE} 2>/dev/null
- done
- sync
- umount layer_top
- umount layer_rw
- rmdir layer_top
- rmdir layer_rw
- [ -f /sbin/ldconfig-2cp-hidden ] && mv -f /sbin/ldconfig-2cp-hidden /sbin/ldconfig
- [ -f /usr/sbin/chroot-2cp-hidden ] && mv -f /usr/sbin/chroot-2cp-hidden /usr/sbin/chroot
-
- fi
-
- if [ -d packages-templates/$GENERICNAME ];then
- echo " postprocessing with packages-templates/$GENERICNAME"
- mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}
-
- cp -a packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE} /tmp/${GENERICNAME}
- for TEMPLATEPATH in `find packages-templates/$GENERICNAME -type d`
- do
- TEMPLATEFILES="`find $TEMPLATEPATH -maxdepth 1 -type f`"
- TEMPLATELINKS="`find $TEMPLATEPATH -maxdepth 1 -type l`"
-
-
- ppPATTERN="s%packages-templates/%packages-${DISTRO_FILE_PREFIX}/%"
-
- TARGETPATH="`echo -n "$TEMPLATEPATH" | sed -e "$ppPATTERN"`"
- mkdir -p $TARGETPATH
-
- TMPPATH="`echo -n "$TEMPLATEPATH" | sed -e 's%packages-templates/%/tmp/%'`"
-
-
- if [ ! -f $TEMPLATEPATH/PLUSEXTRAFILES ];then
- tPATTERN="packages-${DISTRO_FILE_PREFIX}/"
- [ "`echo "$TARGETPATH" | grep "$tPATTERN"`" = "" ] && continue
-
- for ONEDEL in `find ${TARGETPATH} -maxdepth 1 -type f`
- do
-
- DELBASE="`basename $ONEDEL`"
-
- [ ! -f $TEMPLATEPATH/NOEXCEPTIONFILES ] && [ "`echo "$DELBASE" | grep -E '\.[0-9]*\.|\.[0-9]*$|\-[0-9]*\.|[0-9]\.so$|\.so\.[0-9]'`" != "" ] && continue
-
-
- rm $ONEDEL
- done
-
- fi
-
-
- for FINALFILE in $TEMPLATEFILES
- do
- ALTTARGETPATH="$TARGETPATH"
- ALTTMPPATH="$TMPPATH"
- TMPLNAMEONLY="`basename $FINALFILE -FULL`"
- if [ ! -f $TMPPATH/$TMPLNAMEONLY ];then
- if [ "/tmp/${GENERICNAME}" != "$TMPPATH" ];then
- if [ "`echo -n "$TMPPATH" | grep -E "/root|/etc|/dev|/var/"`" = "" ];then
-
- ALTLOCATION="`find /tmp/${GENERICNAME} -type f -name $TMPLNAMEONLY | head -n 1`"
- if [ "$ALTLOCATION" != "" ];then
-
- [ "`file "$ALTLOCATION" | grep ' text'`" = "" ] && ALTTMPPATH="`dirname $ALTLOCATION`"
- else
-
-
- ALTLOCATION="`find /tmp/${GENERICNAME} -type f -name ${TMPLNAMEONLY}.ul | head -n 1`"
- if [ "$ALTLOCATION" != "" ];then
- ALTTMPPATH="`dirname $ALTLOCATION`"
- TMPLNAMEONLY="$TMPLNAMEONLY"'.ul'
-
-
- fi
- fi
- fi
- fi
- fi
-
-
- if [ ! -h $FINALFILE ];then
- if [ ! -s $FINALFILE ];then
- if [ -h $ALTTMPPATH/$TMPLNAMEONLY ];then
- if [ "`echo -n "$FINALFILE" | grep '/usr/'`" = "" ];then
- LINKTNO="$(readlink $ALTTMPPATH/$TMPLNAMEONLY)"
- if [ "$(echo -n "$LINKTNO" | grep '\.\./usr/')" != "" ];then
- if [ -f $ALTTMPPATH/$LINKTNO ];then
- rm -f $ALTTMPPATH/$TMPLNAMEONLY
- mv -f $ALTTMPPATH/$LINKTNO $ALTTMPPATH/
- NEWLINKTNO="$(echo -n "$LINKTNO" | sed -e 's%/usr/%/../%')"
- ln -s $NEWLINKTNO $ALTTMPPATH/$LINKTNO
- fi
- fi
- fi
- fi
- fi
- fi
- if [ -s $FINALFILE ];then
-
- cp -af $FINALFILE $ALTTARGETPATH/
- else
-
- TARGETNAMEONLY="`basename $FINALFILE`"
- if [ "`echo -n "$TARGETNAMEONLY" | grep "STARCHAR"`" != "" ];then
-
- globTARGETNAMEONLY="`echo -n "$TARGETNAMEONLY" | sed -e 's%STARCHAR%*%'`"
- cp -a --remove-destination ${ALTTMPPATH}/${globTARGETNAMEONLY} ${ALTTARGETPATH}/ 2>/dev/null
- else
- cp -a --remove-destination ${ALTTMPPATH}/${TMPLNAMEONLY} ${ALTTARGETPATH}/${TARGETNAMEONLY} 2>/dev/null
- fi
- fi
- done
-
-
- PLUSEXTRADIRS='no'
- TESTPATH="$TEMPLATEPATH"
- while [ "$TESTPATH" != "packages-templates" ];do
- if [ -f $TESTPATH/PLUSEXTRADIRS ];then
- PLUSEXTRADIRS='yes'
- break
- fi
- TESTPATH="`dirname $TESTPATH`"
- done
- if [ "$PLUSEXTRADIRS" = "no" ];then
- TEMPLATEDIRS="`find $TEMPLATEPATH -maxdepth 1 -type d | rev | cut -f 1 -d '/' | rev`"
-
-
-
- xTEMPLATEDIRS="$TEMPLATEDIRS"
- for ONETARGETDIR in `find $TARGETPATH -mindepth 1 -maxdepth 1 -type d | rev | cut -f 1 -d '/' | rev`
- do
-
- [ `echo -n "$TARGETPATH/$ONETARGETDIR" | sed -e 's%[^/]%%g' | wc -c` -le 1 ] && continue
- tPATTERN='^'"$ONETARGETDIR"'$'
- if [ "`echo "$xTEMPLATEDIRS" | grep "$tPATTERN"`" = "" ];then
- tPATTERN="packages-${DISTRO_FILE_PREFIX}/"
- [ "`echo "$TARGETPATH/$ONETARGETDIR" | grep "$tPATTERN"`" != "" ] && rm -rf $TARGETPATH/$ONETARGETDIR
- fi
- done
- fi
-
-
- gnPATTERN="s%raw/${GENERICNAME}/%raw/${GENERICNAME}_DEV/%"
- DEVTARGETPATH="`echo -n "$TARGETPATH" | sed -e "$gnPATTERN"`"
- if [ ! -d $DEVTARGETPATH ];then
- gnPATTERN="s%raw/${GENERICNAME}/%raw/${GENERICNAME}_NULL/%"
- DEVTARGETPATH="`echo -n "$TARGETPATH" | sed -e "$gnPATTERN"`"
- fi
- if [ "$TEMPLATELINKS" != "" -a -d $DEVTARGETPATH ];then
- for ONEDEVLINK in `find $DEVTARGETPATH -maxdepth 1 -type l 2>/dev/null`
- do
- if [ "`readlink $ONEDEVLINK | grep '^/'`" != "" ];then
- READLINK="`readlink $ONEDEVLINK`"
- [ ! -e packages-templates/${GENERICNAME}${READLINK} ] && continue
- fi
- TARGETLINK="`basename $ONEDEVLINK`"
- [ ! -e $TARGETPATH/$TARGETLINK ] && [ ! -L $TARGETPATH/$TARGETLINK ] && cp -af ${ONEDEVLINK} ${TARGETPATH}/
- done
- fi
-
- if [ "$TEMPLATELINKS" != "" ];then
- for ONETEMPLATELINK in $TEMPLATELINKS
- do
- TARGETLINKNAME="`basename $ONETEMPLATELINK`"
- if [ ! -e $TARGETPATH/$TARGETLINKNAME ];then
- mkdir -p $TARGETPATH
- cp -a -f $TEMPLATEPATH/$TARGETLINKNAME $TARGETPATH/
- fi
- done
- fi
-
-
-
-
-
-
-
-
-
- done
-
-
-
- if [ -f packages-templates/$GENERICNAME/FIXUPHACK ];then
- cp -af packages-templates/$GENERICNAME/FIXUPHACK packages-${DISTRO_FILE_PREFIX}/$GENERICNAME/
-
-
- if [ "$EXE" = "_DEV" ];then
-
- mv -f packages-${DISTRO_FILE_PREFIX}/$GENERICNAME/FIXUPHACK packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV/
- cd packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV/
- else
- cd packages-${DISTRO_FILE_PREFIX}/$GENERICNAME/
- fi
- sh ./FIXUPHACK
- cd ../..
-
-
-
-
-
- [ -f packages-${DISTRO_FILE_PREFIX}/$GENERICNAME/FIXUPHACK ] && rm -f packages-${DISTRO_FILE_PREFIX}/$GENERICNAME/FIXUPHACK
- [ -f packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV/FIXUPHACK ] && rm -f packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV/FIXUPHACK
- fi
-
- fi
-
-
-
-
-
- cd sandbox2b
- find ./ -type l | sed -e 's/^\.\///' |
- while read ONESYMLINK
- do
- UPONE="`dirname "$ONESYMLINK"`"
- [ "$UPONE" = "." ] && UPONE=""
- DESTFILE="`readlink $ONESYMLINK`"
- if [ "`echo -n "$DESTFILE" | cut -c 1`" = "/" ];then
- exePATHSPEC="../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}${DESTFILE}"
- devPATHSPEC="../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}${DESTFILE}"
- else
- exePATHSPEC="../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${UPONE}/${DESTFILE}"
- devPATHSPEC="../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${UPONE}/${DESTFILE}"
- fi
- if [ -e $exePATHSPEC ];then
- if [ ! -e ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${ONESYMLINK} ];then
- mkdir -p ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${UPONE}
- cp -a "$ONESYMLINK" ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${EXE}/${UPONE}
- fi
- continue
- fi
- if [ -e $devPATHSPEC ];then
- if [ ! -e ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${ONESYMLINK} ];then
- mkdir -p ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${UPONE}
- cp -a "$ONESYMLINK" ../packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}${DEV}/${UPONE}
- fi
- continue
- fi
- mkdir -p "../sandbox2c/${GENERICNAME}/${UPONE}"
- cp -a --remove-destination "$ONESYMLINK" "../sandbox2c/${GENERICNAME}/${UPONE}"
- done
- cd ..
-
-
- [ -d packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_NULL ] && rm -rf packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_NULL
- [ -d /tmp/${GENERICNAME} ] && rm -rf /tmp/${GENERICNAME}
- done
- if [ -s /tmp/2createpackages-redo ];then
- for ONEREDO in `cat /tmp/2createpackages-redo`
- do
- ./2createpackages $ONEREDO
- done
- fi
- echo
- echo "Script finished."
- if [ -s ERROR-2CREATEPACKAGES ];then
- echo "WARNING: Errors were logged to file ERROR-2CREATEPACKAGES"
- fi
- echo -n "Press ENTER key to exit: "
- read yeahgetout
|