1
0
mirror of https://gitlab.com/JKANetwork/jka-toolkit.git synced 2026-02-19 03:21:32 +01:00
This commit is contained in:
kprkpr
2016-05-29 11:59:56 +02:00
parent d34def1e5f
commit ec0b64e282
4 changed files with 124 additions and 87 deletions

Binary file not shown.

View File

@@ -6,6 +6,32 @@
# $1 is the command
# $2,$3.. will be $packages
#This option is for make if case insensitive
shopt -s nocasematch
#Basic info echo
case "$1" in
*h)
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.4"
echo " Usage: apw <option> [packages]"
echo " {-h | h} Show this help"
echo " {-U | U} Update system"
echo " {-I | I} Install packages (Updates system also for preventing problems)"
echo " {-R | R} Removes a package"
echo " {-Rd | Rd} Removes a package along with dependencies that are not more in use (Only for Arch)"
echo " {-C | C} Clean temp files"
echo " {-Cd | Cd} Clean system from dependencies that are not in use (ADVANCED, BE CAREFUL!)"
echo " {-S | S} Search in package database"
echo " {-F | F} Install file (distro family dependent, e.g. .deb , .pkg.tar.xz,...)"
exit
;;
"")
echo "apw - A Packager Wrapper"
echo "Use apw -h for help"
exit
;;
esac
#Force sudo
uid=$(/usr/bin/id -u)
if [[ $uid != "0" ]];then
@@ -47,9 +73,6 @@ fi
SO=$(cat /etc/apw.conf)
#This option is for make if case insensitive
shopt -s nocasematch
#Reading packages to install/remove.. (The rest of $) , it has to be done before the option echo, logically
packages=$2
for (( i=3; i<=$#; i++ ))
@@ -58,41 +81,6 @@ do
packages="$packages $valtmp"
done
#echo for every option
case "$1" in
*h*)
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.3"
echo " Usage: apw <option> [packages]"
echo " {-h | h} Show this help"
echo " {-U | U} Update system"
echo " {-I | I} Install packages (Updates system also for preventing problems"
echo " {-R | R} Removes a package"
echo " {-S | S} Search in package database"
echo " {-F | F} Install file (distro family dependent, e.g. .deb , .pkg.tar.xz,...)"
exit
;;
*U*)
echo "Updating system";;
*I*)
echo "You are going to install $packages and dependencies";;
*R*)
echo "You are going to remove $packages";;
*S*)
echo "Searching $packages";;
*F*)
echo "Installing files: $packages";;
"")
echo "apw - A Packager Wrapper"
echo "Use apw -h for help"
exit
;;
*)
echo "Invalid option especified"
echo "Use apw -h for help"
exit
;;
esac
#Check if is dnf in RedHat, or apt in Debian, new tools
if [[ $SO = "dnf" && ! -f /usr/bin/dnf ]];then
yum install dnf
@@ -103,52 +91,101 @@ fi
#Command wrapper
if [[ $SO = "apt" ]];then
case "$1" in
*U*)
apt update
apt upgrade
;;
*I*)
apt update
apt install $packages
;;
*R*)
apt remove $packages;;
*S*)
apt search $packages;;
*F*)
dpkg -I $packages;;
esac
fi
case "$1" in
*U)
echo "Updating system"
case "$SO" in
apt)
apt update && apt upgrade;;
pacman)
pacman -Syu $packages;;
yum | dnf | zypper)
$SO update;;
esac;;
*I)
echo "You are going to install $packages and dependencies"
case "$SO" in
apt)
apt update && apt install $packages;;
pacman)
pacman -Syu $packages;;
yum | dnf | zypper)
$SO install $packages;;
esac;;
*R)
echo "You are going to remove $packages"
case "$SO" in
apt)
apt remove $packages;;
pacman)
pacman -R $packages;;
yum | dnf | zypper)
$SO remove $packages;;
esac;;
*Rd)
echo "Removing $packages along with his dependencies that are not more in use"
case "$SO" in
pacman)
pacman -Rs $packages;;
*)
echo "I don't know how to do this option in this packager";;
esac
*C)
echo "Cleaning package manager"
case "$SO" in
apt)
apt clean
apt autoclean
#apt autoremove
;;
pacman)
pacman -Scc;;
yum)
yum clean all;;
dnf)
dnf clean all --enablerepo=\*;;
zypper)
echo "I doesn't know this option in Zypper";;
esac;;
*Cd)
echo "Cleaning system from dependencies that are not in use (BE CAREFUL, ONLY ADVANCED)"
case "$SO" in
apt)
apt autoremove --purge;;
pacman)
pacman -Rs $(pacman -Qdtq);;
*)
echo "I don't know how to do this option in this packager";;
esac;;
*S)
echo "Searching $packages"
case "$SO" in
apt)
apt search $packages;;
pacman)
pacman -Ss $packages;;
yum | dnf | zypper)
$SO search $packages;;
esac;;
*F)
echo "Installing files: $packages"
case "$SO" in
apt)
dpkg -I $packages;;
pacman)
pacman -U $packages;;
yum | dnf | zypper)
rpm -Uvh $packages;;
esac;;
*)
echo "Invalid option especified"
echo "Use apw -h for help"
exit;;
esac
if [[ $SO = "pacman" ]];then
case "$1" in
*U*)
pacman -Syu;;
*I*)
pacman -Syu $packages;;
*R*)
pacman -R $packages;;
*S*)
pacman -Ss $packages;;
*F*)
pacman -U $packages;;
esac
fi
#CentOS 6, RedHat and Suse, use same options of commands, then, I can join it
if [[ $SO = "yum" || $SO = "dnf" || $SO = "zypper" ]];then
case "$1" in
*U*)
$SO update;;
*I*)
$SO install $packages;;
*R*)
$SO remove $packages;;
*S*)
$SO search $packages;;
*F*)
rpm -Uvh $packages;;
*Rd)
pacman -Rs $packages;;
esac
fi

View File

@@ -1,6 +1,6 @@
pkgbase = jka-toolkit
pkgdesc = Set of scripts to optimize the daily work in linux shell (jkazip and apw)
pkgver = 0.2.6
pkgver = 0.2.7
pkgrel = 1
url = http://proyecto.jkanetwork.com
install = jka-toolkit.install
@@ -14,7 +14,7 @@ pkgbase = jka-toolkit
provides = apw
options = !emptydirs
source = https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz
md5sums = e03abc17bdceffedd0176258613a46b8
md5sums = b3588bc1cdceca9356a88aeb17ae8159
pkgname = jka-toolkit

View File

@@ -1,6 +1,6 @@
# Maintainer: JKA Network (JoseluCross, Kprkpr, Yukialba) <contacto@jkanetwork.com>
pkgname=jka-toolkit
pkgver=0.2.6
pkgver=0.2.7
pkgrel=1
pkgdesc="Set of scripts to optimize the daily work in linux shell (jkazip and apw)"
arch=('any')
@@ -11,7 +11,7 @@ provides=('jkazip' 'apw')
options=(!emptydirs)
install=$pkgname.install
source=(https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz)
md5sums=('e03abc17bdceffedd0176258613a46b8')
md5sums=('b3588bc1cdceca9356a88aeb17ae8159')
package() {
cd "$srcdir/$pkgname"