12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232 |
- #!/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" ] || [ "$WOOF_COMPATDISTRO" = "trisquel" ];then
- case $WOOF_COMPATVERSION in
- jaunty|karmic|lucid|dwyn|awen|taranis)
- 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" = "devuan" ];then
- case $WOOF_TARGETARCH in
- x86) ARCHDIR='i386-linux-gnu' ;;
- x86_64) ARCHDIR='x86_64-linux-gnu' ;;
- 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
- ;;
- devuan)
- ARCHDIR='arm-linux-gnueabihf'
- ;;
- ubuntu|trisquel)
- case $WOOF_COMPATVERSION in
- jaunty|karmic|lucid|dwyn|awen|taranis) 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" = "slackware64" ] && BINARIES="tgz_txz"
- [ "$DISTRO_BINARY_COMPAT" = "debian" ] && BINARIES="deb"
- [ "$DISTRO_BINARY_COMPAT" = "devuan" ] && 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 -i -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|trisquel|debian|devuan|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|trisquel|devuan|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}
-
- [ ! -d packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV ] && mkdir -p packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV
-
- find layer_rw -name '.wh.*' -exec rm -r '{}' 2>/dev/null \;
- cp -a --remove-destination layer_rw/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}/ 2>/dev/null
-
- cp -a --remove-destination layer_rw/* packages-${DISTRO_FILE_PREFIX}/${GENERICNAME}_DEV/ 2>/dev/null
-
-
-
-
-
-
- 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
|