mirror of
https://gitlab.com/JKANetwork/jka-toolkit.git
synced 2026-02-18 19:11:31 +01:00
apw update
This commit is contained in:
Binary file not shown.
175
jka-toolkit/apw
Normal file → Executable file
175
jka-toolkit/apw
Normal file → Executable file
@@ -6,14 +6,52 @@
|
|||||||
# $1 is the command
|
# $1 is the command
|
||||||
# $2,$3.. will be $packages
|
# $2,$3.. will be $packages
|
||||||
|
|
||||||
#Knowing the SO with facter
|
|
||||||
#If facter is not installed..
|
#If facter is not installed..
|
||||||
if [[ ! -f /usr/bin/facter ]];then
|
if [[ ! -f /usr/bin/facter ]];then
|
||||||
echo "apw can not run without facter. Please install facter, is a dependency of apw"
|
echo "apw can not run without facter. Please install facter, is a dependency of apw"
|
||||||
exit
|
exit
|
||||||
fi
|
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 $)
|
#Reading packages to install/remove.. (The rest of $)
|
||||||
packages=$2
|
packages=$2
|
||||||
@@ -23,27 +61,6 @@ do
|
|||||||
packages="$packages $valtmp"
|
packages="$packages $valtmp"
|
||||||
done
|
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
|
#Obligar sudo
|
||||||
uid=$(/usr/bin/id -u)
|
uid=$(/usr/bin/id -u)
|
||||||
if [[ $uid != "0" ]];then
|
if [[ $uid != "0" ]];then
|
||||||
@@ -59,83 +76,69 @@ if [[ $SO = "Debian" && ! -f /usr/bin/apt ]];then
|
|||||||
apt-get update && apt-get install apt
|
apt-get update && apt-get install apt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Command wrapper
|
||||||
|
|
||||||
#Ejecución de comandos
|
|
||||||
if [[ $SO = "Debian" ]];then
|
if [[ $SO = "Debian" ]];then
|
||||||
if [[ $1 = "-U" || $1 = "U" ]];then
|
case "$1" in
|
||||||
|
*U*)
|
||||||
apt update
|
apt update
|
||||||
apt upgrade
|
apt upgrade
|
||||||
fi
|
;;
|
||||||
if [[ $1 = "-I" || $1 = "I" ]];then
|
*I*)
|
||||||
echo "You are going to install $packages and dependencies"
|
|
||||||
apt update
|
apt update
|
||||||
apt install $packages
|
apt install $packages
|
||||||
fi
|
;;
|
||||||
if [[ $1 = "-R" || $1 = "R" ]];then
|
*R*)
|
||||||
apt remove $packages
|
apt remove $packages;;
|
||||||
fi
|
*S*)
|
||||||
if [[ $1 = "-S" || $1 = "S" ]];then
|
apt search $packages;;
|
||||||
apt search $packages
|
*F*)
|
||||||
fi
|
dpkg -I $packages;;
|
||||||
if [[ $1 = "-F" || $1 = "F" ]];then
|
esac
|
||||||
dpkg -I $packages
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SO = "Archlinux" ]];then
|
if [[ $SO = "Archlinux" ]];then
|
||||||
if [[ $1 = "-U" || $1 = "U" ]];then
|
case "$1" in
|
||||||
pacman -Syu
|
*U*)
|
||||||
fi
|
pacman -Syu;;
|
||||||
if [[ $1 = "-I" || $1 = "I" ]];then
|
*I*)
|
||||||
echo "You are going to install $packages and dependencies"
|
pacman -Syu $packages;;
|
||||||
pacman -Syu $packages
|
*R*)
|
||||||
fi
|
pacman -R $packages;;
|
||||||
if [[ $1 = "-R" || $1 = "R" ]];then
|
*S*)
|
||||||
pacman -R $packages
|
pacman -Ss $packages;;
|
||||||
fi
|
*F*)
|
||||||
if [[ $1 = "-S" || $1 = "S" ]];then
|
pacman -U $packages;;
|
||||||
pacman -Ss $packages
|
esac
|
||||||
fi
|
|
||||||
if [[ $1 = "-F" || $1 = "F" ]];then
|
|
||||||
pacman -U $packages
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#RedHat and Fedora
|
#RedHat and Fedora
|
||||||
if [[ $SO = "RedHat" ]];then
|
if [[ $SO = "RedHat" ]];then
|
||||||
if [[ $1 = "-U" || $1 = "U" ]];then
|
case "$1" in
|
||||||
dnf update
|
*U*)
|
||||||
fi
|
dnf update;;
|
||||||
if [[ $1 = "-I" || $1 = "I" ]];then
|
*I*)
|
||||||
echo "You are going to install $packages and dependencies"
|
dnf install $packages;;
|
||||||
dnf install $packages
|
*R*)
|
||||||
fi
|
dnf remove $packages;;
|
||||||
if [[ $1 = "-R" || $1 = "R" ]];then
|
*S*)
|
||||||
dnf remove $packages
|
dnf search $packages;;
|
||||||
fi
|
*F*)
|
||||||
if [[ $1 = "-S" || $1 = "S" ]];then
|
rpm -Uvh $packages;;
|
||||||
dnf search $packages
|
esac
|
||||||
fi
|
|
||||||
if [[ $1 = "-F" || $1 = "F" ]];then
|
|
||||||
rpm -Uvh $packages
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SO = "Suse" ]];then
|
if [[ $SO = "Suse" ]];then
|
||||||
if [[ $1 = "-U" || $1 = "U" ]];then
|
case "$1" in
|
||||||
zypper update
|
*U*)
|
||||||
fi
|
zypper update;;
|
||||||
if [[ $1 = "-I" || $1 = "I" ]];then
|
*I*)
|
||||||
echo "You are going to install $packages and dependencies"
|
zypper install $packages;;
|
||||||
zypper install $packages
|
*R*)
|
||||||
fi
|
zypper remove $packages;;
|
||||||
if [[ $1 = "-R" || $1 = "R" ]];then
|
*S*)
|
||||||
zypper remove $packages
|
zypper search $packages;;
|
||||||
fi
|
*F*)
|
||||||
if [[ $1 = "-S" || $1 = "S" ]];then
|
rpm -Uvh $packages;;
|
||||||
zypper search $packages
|
esac
|
||||||
fi
|
|
||||||
if [[ $1 = "-F" || $1 = "F" ]];then
|
|
||||||
rpm -Uvh $packages
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
pkgbase = jka-toolkit
|
pkgbase = jka-toolkit
|
||||||
pkgdesc = Set of scripts to optimize the daily work in linux shell
|
pkgdesc = Set of scripts to optimize the daily work in linux shell (jkazip and apw)
|
||||||
pkgver = 0.2.3
|
pkgver = 0.2.4
|
||||||
pkgrel = 3
|
pkgrel = 1
|
||||||
url = http://proyecto.jkanetwork.com
|
url = http://proyecto.jkanetwork.com
|
||||||
install = jka-toolkit.install
|
install = jka-toolkit.install
|
||||||
arch = any
|
arch = any
|
||||||
@@ -9,9 +9,14 @@ pkgbase = jka-toolkit
|
|||||||
depends = p7zip
|
depends = p7zip
|
||||||
depends = unrar
|
depends = unrar
|
||||||
depends = unzip
|
depends = unzip
|
||||||
|
depends = tar
|
||||||
|
depends = zip
|
||||||
|
depends = facter
|
||||||
|
provides = jkazip
|
||||||
|
provides = apw
|
||||||
options = !emptydirs
|
options = !emptydirs
|
||||||
source = https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz
|
source = https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz
|
||||||
md5sums = c71687f426a4562ae794bc6218b2575a
|
md5sums = af4b1cd2ae39dd4c7bf5aa918b0c96b3
|
||||||
|
|
||||||
pkgname = jka-toolkit
|
pkgname = jka-toolkit
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Maintainer: JKA Network (JoseluCross, Kprkpr, Yukialba) <contacto@jkanetwork.com>
|
# Maintainer: JKA Network (JoseluCross, Kprkpr, Yukialba) <contacto@jkanetwork.com>
|
||||||
pkgname=jka-toolkit
|
pkgname=jka-toolkit
|
||||||
pkgver=0.2.3
|
pkgver=0.2.4
|
||||||
pkgrel=3
|
pkgrel=1
|
||||||
pkgdesc="Set of scripts to optimize the daily work in linux shell (jkazip and apw)"
|
pkgdesc="Set of scripts to optimize the daily work in linux shell (jkazip and apw)"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
url="http://proyecto.jkanetwork.com"
|
url="http://proyecto.jkanetwork.com"
|
||||||
@@ -11,7 +11,7 @@ provides=('jkazip' 'apw')
|
|||||||
options=(!emptydirs)
|
options=(!emptydirs)
|
||||||
install=$pkgname.install
|
install=$pkgname.install
|
||||||
source=(https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz)
|
source=(https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz)
|
||||||
md5sums=('bfdecb9f720f66933f9ad1f07634e68c')
|
md5sums=('af4b1cd2ae39dd4c7bf5aa918b0c96b3')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/$pkgname"
|
cd "$srcdir/$pkgname"
|
||||||
|
|||||||
Reference in New Issue
Block a user