Use bash as shell; su instead of sudo; don't proceed if a command fails; change default to not installing

This commit is contained in:
Abhinav Baid 2017-04-10 11:46:15 +05:30
parent 90f94d6053
commit 96ca325a25
2 changed files with 18 additions and 5 deletions

View File

@ -1,12 +1,25 @@
#!/bin/sh #!/bin/bash
./tarball.sh ./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 -g >> PKGBUILD
makepkg -sc 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 rm -f ./*.tar.gz
sed -i '$ d' PKGBUILD 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 case $yn in
[Nn]* ) exit;; [Yy]* ) su -c "pacman -U ./*.pkg.tar.xz"; rm -f ./*.pkg.tar.xz;;
* ) sudo pacman -U ./*.pkg.tar.xz; rm -f ./*.pkg.tar.xz;; * ) exit;;
esac esac