From 96ca325a258fbe2d2db5265578f42d17fe73c436 Mon Sep 17 00:00:00 2001 From: Abhinav Baid Date: Mon, 10 Apr 2017 11:46:15 +0530 Subject: [PATCH] Use bash as shell; su instead of sudo; don't proceed if a command fails; change default to not installing --- package_creators/arch.sh | 21 +++++++++++++++++---- package_creators/tarball.sh | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/package_creators/arch.sh b/package_creators/arch.sh index d19eaa21..4b927f5e 100755 --- a/package_creators/arch.sh +++ b/package_creators/arch.sh @@ -1,12 +1,25 @@ -#!/bin/sh +#!/bin/bash ./tarball.sh +retval=$? +if [ $retval -ne 0 ]; then + echo "Sorry, the package could not be created as the tarball building process failed with return code $retval" + rm -f ./*.tar.gz + exit $retval +fi makepkg -g >> PKGBUILD makepkg -sc +retval=$? +if [ $retval -ne 0 ]; then + echo "Sorry, the package could not be created as the makepkg failed with return code $retval" + rm -rf ./*.tar.gz src + sed -i '$ d' PKGBUILD + exit $retval +fi rm -f ./*.tar.gz sed -i '$ d' PKGBUILD -read -p "Do you wish to install ccextractor? [Y/n] " yn +read -p "Do you wish to install ccextractor? [y/N] " yn case $yn in - [Nn]* ) exit;; - * ) sudo pacman -U ./*.pkg.tar.xz; rm -f ./*.pkg.tar.xz;; + [Yy]* ) su -c "pacman -U ./*.pkg.tar.xz"; rm -f ./*.pkg.tar.xz;; + * ) exit;; esac diff --git a/package_creators/tarball.sh b/package_creators/tarball.sh index e949911b..113ce340 100755 --- a/package_creators/tarball.sh +++ b/package_creators/tarball.sh @@ -27,4 +27,4 @@ rm -rf config.log rm -rf aclocal.m4 rm -rf build-conf rm -rf autom4te.cache -cd package_creators \ No newline at end of file +cd package_creators