mirror of
https://gitlab.com/JKANetwork/jka-toolkit.git
synced 2026-02-19 19:41:31 +01:00
New apw 1.3
This commit is contained in:
Binary file not shown.
@@ -1,17 +1,52 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# apw, a simple packager wrapper for Arch, Debian, RedHat/Fedora, and Suse (And all his derivates)
|
# apw, a simple packager wrapper for Arch, Debian, RedHat/Fedora, CentOS 6, Suse, and all his derivates)
|
||||||
# It simplifies the process of remembering pacman,apt,dnf, etc , all in one called apw
|
# It simplifies the process of remembering pacman,apt,dnf, etc , all in one called apw
|
||||||
# Author: JKA Network - contacto@jkanetwork.com
|
# Author: JKA Network - contacto@jkanetwork.com
|
||||||
|
|
||||||
# $1 is the command
|
# $1 is the command
|
||||||
# $2,$3.. will be $packages
|
# $2,$3.. will be $packages
|
||||||
|
|
||||||
#If facter is not installed..
|
#Force sudo
|
||||||
if [[ ! -f /usr/bin/facter ]];then
|
uid=$(/usr/bin/id -u)
|
||||||
echo "apw can not run without facter. Please install facter, is a dependency of apw"
|
if [[ $uid != "0" ]];then
|
||||||
exit
|
echo "apw has to run as root, please run as root/with sudo"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f /etc/apw.conf ]];then
|
||||||
|
echo "It's the first run of the program, we need a thing before continue"
|
||||||
|
echo "What, or in what is based your Linux?"
|
||||||
|
echo "(The answer will be recorded in /etc/apw.conf, if you want to reset apw, delete this file)"
|
||||||
|
options=("Debian/Ubuntu (apt)" "Fedora/Redhat (dnf)" "CentOS 6 (yum)" "Archlinux (pacman)" "Suse (zypper)")
|
||||||
|
select opt in "${options[@]}"
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
"Debian/Ubuntu (apt)")
|
||||||
|
echo "apt" > /etc/apw.conf
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"Fedora/Redhat (dnf)")
|
||||||
|
echo "dnf" > /etc/apw.conf
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"CentOS 6 (yum)")
|
||||||
|
echo "yum" > /etc/apw.conf
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"Archlinux (pacman)")
|
||||||
|
echo "pacman" > /etc/apw.conf
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"Suse (zypper)")
|
||||||
|
echo "zypper" > /etc/apw.conf
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
SO=$(cat /etc/apw.conf)
|
||||||
|
|
||||||
#This option is for make if case insensitive
|
#This option is for make if case insensitive
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
|
||||||
@@ -26,7 +61,7 @@ done
|
|||||||
#echo for every option
|
#echo for every option
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*h*)
|
*h*)
|
||||||
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.2"
|
echo "apw - A Packager Wrapper, a Idea from JKA Network, version 1.3"
|
||||||
echo " Usage: apw <option> [packages]"
|
echo " Usage: apw <option> [packages]"
|
||||||
echo " {-h | h} Show this help"
|
echo " {-h | h} Show this help"
|
||||||
echo " {-U | U} Update system"
|
echo " {-U | U} Update system"
|
||||||
@@ -58,28 +93,17 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
#Obligar sudo antes de hacer operaciones que puedan requerirlo
|
|
||||||
uid=$(/usr/bin/id -u)
|
|
||||||
if [[ $uid != "0" ]];then
|
|
||||||
echo "apw has to run as root, please run as root/with sudo"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Knowing the SO with facter
|
|
||||||
SO=$(facter osfamily)
|
|
||||||
|
|
||||||
#Check if is dnf in RedHat, or apt in Debian, new tools
|
#Check if is dnf in RedHat, or apt in Debian, new tools
|
||||||
if [[ $SO = "RedHat" && ! -f /usr/bin/dnf ]];then
|
if [[ $SO = "dnf" && ! -f /usr/bin/dnf ]];then
|
||||||
yum install dnf
|
yum install dnf
|
||||||
fi
|
fi
|
||||||
if [[ $SO = "Debian" && ! -f /usr/bin/apt ]];then
|
if [[ $SO = "apt" && ! -f /usr/bin/apt ]];then
|
||||||
apt-get update && apt-get install apt
|
apt-get update && apt-get install apt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Command wrapper
|
#Command wrapper
|
||||||
|
|
||||||
if [[ $SO = "Debian" ]];then
|
if [[ $SO = "apt" ]];then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*U*)
|
*U*)
|
||||||
apt update
|
apt update
|
||||||
@@ -98,7 +122,7 @@ if [[ $SO = "Debian" ]];then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SO = "Archlinux" ]];then
|
if [[ $SO = "pacman" ]];then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*U*)
|
*U*)
|
||||||
pacman -Syu;;
|
pacman -Syu;;
|
||||||
@@ -113,32 +137,17 @@ if [[ $SO = "Archlinux" ]];then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#RedHat and Fedora
|
#CentOS 6, RedHat and Suse, use same options of commands, then, I can join it
|
||||||
if [[ $SO = "RedHat" ]];then
|
if [[ $SO = "yum" || $SO = "dnf" || $SO = "zypper" ]];then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*U*)
|
*U*)
|
||||||
dnf update;;
|
$SO update;;
|
||||||
*I*)
|
*I*)
|
||||||
dnf install $packages;;
|
$SO install $packages;;
|
||||||
*R*)
|
*R*)
|
||||||
dnf remove $packages;;
|
$SO remove $packages;;
|
||||||
*S*)
|
*S*)
|
||||||
dnf search $packages;;
|
$SO search $packages;;
|
||||||
*F*)
|
|
||||||
rpm -Uvh $packages;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $SO = "Suse" ]];then
|
|
||||||
case "$1" in
|
|
||||||
*U*)
|
|
||||||
zypper update;;
|
|
||||||
*I*)
|
|
||||||
zypper install $packages;;
|
|
||||||
*R*)
|
|
||||||
zypper remove $packages;;
|
|
||||||
*S*)
|
|
||||||
zypper search $packages;;
|
|
||||||
*F*)
|
*F*)
|
||||||
rpm -Uvh $packages;;
|
rpm -Uvh $packages;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pkgbase = jka-toolkit
|
pkgbase = jka-toolkit
|
||||||
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)
|
||||||
pkgver = 0.2.5
|
pkgver = 0.2.6
|
||||||
pkgrel = 2
|
pkgrel = 1
|
||||||
url = http://proyecto.jkanetwork.com
|
url = http://proyecto.jkanetwork.com
|
||||||
install = jka-toolkit.install
|
install = jka-toolkit.install
|
||||||
arch = any
|
arch = any
|
||||||
@@ -10,12 +10,11 @@ pkgbase = jka-toolkit
|
|||||||
depends = unrar
|
depends = unrar
|
||||||
depends = unzip
|
depends = unzip
|
||||||
depends = zip
|
depends = zip
|
||||||
depends = facter
|
|
||||||
provides = jkazip
|
provides = jkazip
|
||||||
provides = apw
|
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 = 2f2d776a4201f0628cae8c0ea0e12d22
|
md5sums = e03abc17bdceffedd0176258613a46b8
|
||||||
|
|
||||||
pkgname = jka-toolkit
|
pkgname = jka-toolkit
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
# 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.5
|
pkgver=0.2.6
|
||||||
pkgrel=2
|
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"
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=('p7zip' 'unrar' 'unzip' 'zip' 'facter')
|
depends=('p7zip' 'unrar' 'unzip' 'zip')
|
||||||
provides=('jkazip' 'apw')
|
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=('2f2d776a4201f0628cae8c0ea0e12d22')
|
md5sums=('e03abc17bdceffedd0176258613a46b8')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/$pkgname"
|
cd "$srcdir/$pkgname"
|
||||||
|
|||||||
Reference in New Issue
Block a user