Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Lines 117 to 162 of /usr/sbin/petget (tahrpup) - https://www.pearltrees.com/s243a/source-petget-usr-sbin/id20395775/item224036691
- #split PKGMAIN, ex: FULLPKGNAME=xvidtune-1.0.1-i486-1.tgz has PKGNAME=xvidtune-1.0.1
- case $EXT in
- .deb)
- #deb ex: xsltproc_1.1.24-1ubuntu2_i386.deb xserver-common_1.5.2-2ubuntu3_all.deb
- DB_nameonly="`echo -n "$PKGMAIN" | cut -f 1 -d '_'`"
- DB_pkgrelease="`echo -n "$PKGMAIN" | rev | cut -f 2 -d '_' | cut -f 1 -d '-' | rev`"
- prPATTERN="s%\\-${DB_pkgrelease}.*%%"
- PKGNAME="`echo -n "$PKGMAIN" | sed -e "$prPATTERN"`"
- DB_version="`echo "$PKGNAME" | cut -f 2 -d '_'`"
- ;;
- .pet)
- PKGNAME="$PKGMAIN"
- DB_version="`echo -n "$PKGNAME" | grep -o '\\-[0-9].*' | sed -e 's%^\-%%'`"
- xDB_version="`echo -n "$DB_version" | sed -e 's%\\-%\\\\-%g' -e 's%\\.%\\\\.%g'`"
- xPATTERN="s%${xDB_version}%%"
- DB_nameonly="`echo -n "$PKGNAME" | sed -e "$xPATTERN" -e 's%\\-$%%'`"
- DB_pkgrelease=""
- ;;
- .tgz|.txz)
- #slack ex: xvidtune-1.0.1-i486-1.tgz printproto-1.0.4-noarch-1.tgz
- PKGNAME="`echo -n "$PKGMAIN" | sed -e 's%\\-i[3456]86.*%%' -e 's%\\-noarch.*%%'`"
- DB_version="`echo -n "$PKGNAME" | grep -o '\\-[0-9].*' | sed -e 's%^\\-%%'`"
- xDB_version="`echo -n "$DB_version" | sed -e 's%\\-%\\\\-%g' -e 's%\\.%\\\\.%g'`"
- xPATTERN="s%${xDB_version}%%"
- DB_nameonly="`echo -n "$PKGNAME" | sed -e "$xPATTERN" -e 's%\-$%%'`"
- DB_pkgrelease="`echo -n "$PKGMAIN" | sed -e 's%.*\\-i[3456]86%%' -e 's%.*\\-noarch%%' -e 's%^\\-%%'`"
- ;;
- .tar.gz)
- #arch ex: xproto-7.0.14-1-i686.pkg.tar.gz trapproto-3.4.3-1.pkg.tar.gz
- PKGNAME="`echo -n "$PKGMAIN" | sed -e 's%\\-i[3456]86.*%%' -e 's%\\.pkg$%%' | rev | cut -f 2-9 -d '-' | rev`"
- DB_version="`echo -n "$PKGNAME" | grep -o '\\-[0-9].*' | sed -e 's%^\\-%%'`"
- xDB_version="`echo -n "$DB_version" | sed -e 's%\\-%\\\\-%g' -e 's%\\.%\\\\.%g'`"
- xPATTERN="s%${xDB_version}%%"
- DB_nameonly="`echo -n "$PKGNAME" | sed -e "$xPATTERN" -e 's%\\-$%%'`"
- DB_pkgrelease="`echo -n "$PKGMAIN" | sed -e 's%\\-i[3456]86.*%%' -e 's%\\.pkg$%%' | rev | cut -f 1 -d '-' | rev`"
- ;;
- .rpm) #110523
- #exs: hunspell-fr-3.4-1.1.el6.noarch.rpm
- PKGNAME="$PKGMAIN"
- DB_version="`echo -n "$PKGNAME" | grep -o '\\-[0-9].*' | sed -e 's%^\-%%'`"
- xDB_version="`echo -n "$DB_version" | sed -e 's%\\-%\\\\-%g' -e 's%\\.%\\\\.%g'`"
- xPATTERN="s%${xDB_version}%%"
- DB_nameonly="`echo -n "$PKGNAME" | sed -e "$xPATTERN" -e 's%\\-$%%'`"
- DB_pkgrelease=""
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement