summaryrefslogtreecommitdiff
path: root/src/librerepkg
diff options
context:
space:
mode:
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 d506003..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
- msg2 "Updating md5sums"
- makepkg -gp rePKGBUILD >> rePKGBUILD
+ echo "export CARCH=${_arch}" >> rePKGBUILD
- echo "export CARCH=${_arch}" >> 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 "$@"