summaryrefslogtreecommitdiff
path: root/src/librerepkg
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-30 01:00:18 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-30 01:00:18 -0300
commitb021874d73c9dded2e05f2095efa5c3a6d23b496 (patch)
treeb2b9a7bd88f0476accd17d23c1ef53c7cc920be7 /src/librerepkg
parent73b813613aa08646515f4e06c71503b18125cec3 (diff)
parentba312fb72ec0843297978796a20c6ffc1fe3ef6e (diff)
Merge branch 'master' of http://projects.parabolagnulinux.org/libretools
Conflicts: src/aur src/chroot-tools/librechroot src/librerepkg
Diffstat (limited to 'src/librerepkg')
-rwxr-xr-xsrc/librerepkg73
1 files changed, 35 insertions, 38 deletions
diff --git a/src/librerepkg b/src/librerepkg
index 5cb0fa3..85c58d9 100755
--- a/src/librerepkg
+++ b/src/librerepkg
@@ -18,55 +18,52 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-source /etc/libretools.conf
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-if [ -x $custom_config ]; then
- source $custom_config;
- unset $custom_config
-fi
-
-[[ ! -r rePKGBUILD ]] && {
- error "This build does not contains a rePKGBUILD."
- exit 1
-}
+. /etc/libretools.conf
+. /etc/makepkg.conf
+. /etc/abs.conf
-source /etc/makepkg.conf
-source /etc/abs.conf
-source rePKGBUILD
+cmd=${0##*/}
usage() {
- echo "cd to a dir with a rePKGBUILD and other file info and run"
- echo "$0 [makepkg flags]"
- echo
- echo "This script will repackage an arch package without compiling"
+ echo "cd to a dir with a rePKGBUILD and other file info and run"
+ echo "$cmd [makepkg flags]"
+ echo ""
+ echo "This script will repackage an arch package without compiling"
}
-while getopts 'h' arg; do
- case $arg in
- h) usage; exit 0 ;;
- esac
-done
-
-makepkgflags=$@
+main() {
+ while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+ done
+ makepkgflags=("$@")
-tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)
+ if [[ ! -r rePKGBUILD ]]; then
+ error "This build does not contains a rePKGBUILD."
+ exit 1
+ fi
+ . rePKGBUILD
-msg "Copying files"
-cp ./* ${tempdir}/
+ tempdir="$(mktemp --tmpdir -d ${PWD##*/}.XXXXX)"
-for _arch in ${arch[@]}; do
+ msg "Copying files"
+ cp ./* "${tempdir}/"
- msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
+ for _arch in "${arch[@]}"; do
+ msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
+ stdnull pushd "${tempdir}"
- stdnull pushd ${tempdir}
+ msg2 "Updating md5sums"
+ makepkg -gp rePKGBUILD >> rePKGBUILD
- echo "export CARCH=${_arch}" >> PKGBUILD
+ echo "export CARCH=${_arch}" >> rePKGBUILD
- msg2 "Updating md5sums"
- makepkg -gp rePKGBUILD >> rePKGBUILD
+ msg "Repackaging using makepkg"
+ makepkg -Lcdp rePKGBUILD "${makepkgflags[@]}"
- msg "Repackaging using makepkg"
- makepkg -Lcdp rePKGBUILD ${makepkgflags}
+ stdnull popd "${tempdir}"
+ done
+}
- stdnull popd ${tempdir}
-done
+main "$@"