1
0
mirror of https://gitlab.com/JKANetwork/jka-toolkit.git synced 2026-02-16 18:11:33 +01:00

apw update

This commit is contained in:
kprkpr
2016-05-23 20:41:33 +02:00
parent c28a58eb7a
commit 8428ce90af
4 changed files with 106 additions and 98 deletions

Binary file not shown.

185
jka-toolkit/apw Normal file → Executable file
View File

@@ -6,14 +6,52 @@
# $1 is the command
# $2,$3.. will be $packages
#Knowing the SO with facter
#If facter is not installed..
if [[ ! -f /usr/bin/facter ]];then
echo "apw can not run without facter. Please install facter, is a dependency of apw"
exit
fi
SO=$(facter osfamily)
#This option is for make if case insensitive
shopt -s nocasematch
#echo for every option
case "$1" in
*h*)
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.1"
echo " Usage: apw <option> [packages]"
echo " {-h | h} 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, ej .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
#Knowing the SO with facter
SO=$(facter osfamily)
#Reading packages to install/remove.. (The rest of $)
packages=$2
@@ -23,27 +61,6 @@ do
packages="$packages $valtmp"
done
if [[ -z "$1" ]];then
echo "No option especified"
echo "Use apw -h for help"
exit
fi
#This option is for make if case insensitive
shopt -s nocasematch
if [[ $1 = "-h" || $1 = "h" ]];then
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.0"
echo " Usage: apw <option> [packages]"
echo " {-h | h} 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, ej .deb , .pkg.tar.xz,...)"
exit
fi
#Obligar sudo
uid=$(/usr/bin/id -u)
if [[ $uid != "0" ]];then
@@ -59,83 +76,69 @@ if [[ $SO = "Debian" && ! -f /usr/bin/apt ]];then
apt-get update && apt-get install apt
fi
#Command wrapper
#Ejecución de comandos
if [[ $SO = "Debian" ]];then
if [[ $1 = "-U" || $1 = "U" ]];then
apt update
apt upgrade
fi
if [[ $1 = "-I" || $1 = "I" ]];then
echo "You are going to install $packages and dependencies"
apt update
apt install $packages
fi
if [[ $1 = "-R" || $1 = "R" ]];then
apt remove $packages
fi
if [[ $1 = "-S" || $1 = "S" ]];then
apt search $packages
fi
if [[ $1 = "-F" || $1 = "F" ]];then
dpkg -I $packages
fi
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
if [[ $SO = "Archlinux" ]];then
if [[ $1 = "-U" || $1 = "U" ]];then
pacman -Syu
fi
if [[ $1 = "-I" || $1 = "I" ]];then
echo "You are going to install $packages and dependencies"
pacman -Syu $packages
fi
if [[ $1 = "-R" || $1 = "R" ]];then
pacman -R $packages
fi
if [[ $1 = "-S" || $1 = "S" ]];then
pacman -Ss $packages
fi
if [[ $1 = "-F" || $1 = "F" ]];then
pacman -U $packages
fi
case "$1" in
*U*)
pacman -Syu;;
*I*)
pacman -Syu $packages;;
*R*)
pacman -R $packages;;
*S*)
pacman -Ss $packages;;
*F*)
pacman -U $packages;;
esac
fi
#RedHat and Fedora
if [[ $SO = "RedHat" ]];then
if [[ $1 = "-U" || $1 = "U" ]];then
dnf update
fi
if [[ $1 = "-I" || $1 = "I" ]];then
echo "You are going to install $packages and dependencies"
dnf install $packages
fi
if [[ $1 = "-R" || $1 = "R" ]];then
dnf remove $packages
fi
if [[ $1 = "-S" || $1 = "S" ]];then
dnf search $packages
fi
if [[ $1 = "-F" || $1 = "F" ]];then
rpm -Uvh $packages
fi
case "$1" in
*U*)
dnf update;;
*I*)
dnf install $packages;;
*R*)
dnf remove $packages;;
*S*)
dnf search $packages;;
*F*)
rpm -Uvh $packages;;
esac
fi
if [[ $SO = "Suse" ]];then
if [[ $1 = "-U" || $1 = "U" ]];then
zypper update
fi
if [[ $1 = "-I" || $1 = "I" ]];then
echo "You are going to install $packages and dependencies"
zypper install $packages
fi
if [[ $1 = "-R" || $1 = "R" ]];then
zypper remove $packages
fi
if [[ $1 = "-S" || $1 = "S" ]];then
zypper search $packages
fi
if [[ $1 = "-F" || $1 = "F" ]];then
rpm -Uvh $packages
fi
fi
case "$1" in
*U*)
zypper update;;
*I*)
zypper install $packages;;
*R*)
zypper remove $packages;;
*S*)
zypper search $packages;;
*F*)
rpm -Uvh $packages;;
esac
fi

View File

@@ -1,7 +1,7 @@
pkgbase = jka-toolkit
pkgdesc = Set of scripts to optimize the daily work in linux shell
pkgver = 0.2.3
pkgrel = 3
pkgdesc = Set of scripts to optimize the daily work in linux shell (jkazip and apw)
pkgver = 0.2.4
pkgrel = 1
url = http://proyecto.jkanetwork.com
install = jka-toolkit.install
arch = any
@@ -9,9 +9,14 @@ pkgbase = jka-toolkit
depends = p7zip
depends = unrar
depends = unzip
depends = tar
depends = zip
depends = facter
provides = jkazip
provides = apw
options = !emptydirs
source = https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz
md5sums = c71687f426a4562ae794bc6218b2575a
md5sums = af4b1cd2ae39dd4c7bf5aa918b0c96b3
pkgname = jka-toolkit

View File

@@ -1,7 +1,7 @@
# Maintainer: JKA Network (JoseluCross, Kprkpr, Yukialba) <contacto@jkanetwork.com>
pkgname=jka-toolkit
pkgver=0.2.3
pkgrel=3
pkgver=0.2.4
pkgrel=1
pkgdesc="Set of scripts to optimize the daily work in linux shell (jkazip and apw)"
arch=('any')
url="http://proyecto.jkanetwork.com"
@@ -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=('bfdecb9f720f66933f9ad1f07634e68c')
md5sums=('af4b1cd2ae39dd4c7bf5aa918b0c96b3')
package() {
cd "$srcdir/$pkgname"