3 # re-pacman: regenerate a pacman package based on installed files and the
4 # pacman database entries. Useful for reuse, or possible config file
7 # Copyright (c) 2006 Aaron Griffin <aaron@archlinux.org>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # * Check for md5 changes in backup lines and change pkgrel
27 [ $# -ne 2 ] && return 1
28 #use echo to strip spaces
29 echo $
(pacman
-Qi ${1} |
grep "${2}" | cut
-d: -f2-)
33 echo "# Generated by re-pacman 1.0.0"
35 echo "pkgname =$(pacinfo ${1} Name)"
36 echo "pkgver =$(pacinfo ${1} Version)"
37 echo "pkgdesc =$(pacinfo ${1} Description)"
38 echo "url =$(pacinfo ${1} URL)"
39 echo "builddate =$(pacinfo ${1} 'Build Date')"
40 echo "packager =$(pacinfo ${1} Packager)"
41 echo "size =$(pacinfo ${1} Size)"
42 echo "arch =$(pacinfo ${1} Architecture)"
43 deps
=$
(pacinfo
${1} 'Depends On')
52 echo "usage: re-pacman <installed package name>"
56 ver
=$
(pacinfo
${1} Version
)
57 if [ "x${ver}" = "x" ]; then
58 echo "Package '${1}' not found, aborting."
62 echo ":: Cleaning up old files"
63 rm -f .PKGINFO
"${1}-${ver}.pkg.tar.gz"
65 echo ":: Building PKGINFO"
66 make_pkginfo
${1} > .PKGINFO
69 flist
="${flist} $(pacman -Ql ${1} | sed 's|\w* \(.*\)|/\1|g' | grep -v '/$')"
71 echo ":: Building final package tarball"
72 echo ${flist} | tr ' ' '\n' | tar czf "${1}-${ver}.pkg.
tar.gz
" -T - 2>/dev/null
75 echo ":: Package
'${1}-${ver}.pkg.tar.gz' is now ready
for installation
"
77 # vim: set ts=2 sw=2 noet: