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

New apw 1.3

This commit is contained in:
kprkpr
2016-05-25 11:54:22 +02:00
parent 2ff398b445
commit d34def1e5f
4 changed files with 58 additions and 50 deletions

Binary file not shown.

View File

@@ -1,17 +1,52 @@
#!/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
# Author: JKA Network - contacto@jkanetwork.com
# $1 is the command
# $2,$3.. will be $packages
#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
#Force sudo
uid=$(/usr/bin/id -u)
if [[ $uid != "0" ]];then
echo "apw has to run as root, please run as root/with sudo"
exit
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
shopt -s nocasematch
@@ -26,7 +61,7 @@ done
#echo for every option
case "$1" in
*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 " {-h | h} Show this help"
echo " {-U | U} Update system"
@@ -58,28 +93,17 @@ case "$1" in
;;
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
if [[ $SO = "RedHat" && ! -f /usr/bin/dnf ]];then
if [[ $SO = "dnf" && ! -f /usr/bin/dnf ]];then
yum install dnf
fi
if [[ $SO = "Debian" && ! -f /usr/bin/apt ]];then
if [[ $SO = "apt" && ! -f /usr/bin/apt ]];then
apt-get update && apt-get install apt
fi
#Command wrapper
if [[ $SO = "Debian" ]];then
if [[ $SO = "apt" ]];then
case "$1" in
*U*)
apt update
@@ -98,7 +122,7 @@ if [[ $SO = "Debian" ]];then
esac
fi
if [[ $SO = "Archlinux" ]];then
if [[ $SO = "pacman" ]];then
case "$1" in
*U*)
pacman -Syu;;
@@ -113,32 +137,17 @@ if [[ $SO = "Archlinux" ]];then
esac
fi
#RedHat and Fedora
if [[ $SO = "RedHat" ]];then
#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*)
dnf update;;
$SO update;;
*I*)
dnf install $packages;;
$SO install $packages;;
*R*)
dnf remove $packages;;
$SO remove $packages;;
*S*)
dnf 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;;
$SO search $packages;;
*F*)
rpm -Uvh $packages;;
esac

View File

@@ -1,7 +1,7 @@
pkgbase = jka-toolkit
pkgdesc = Set of scripts to optimize the daily work in linux shell (jkazip and apw)
pkgver = 0.2.5
pkgrel = 2
pkgver = 0.2.6
pkgrel = 1
url = http://proyecto.jkanetwork.com
install = jka-toolkit.install
arch = any
@@ -10,12 +10,11 @@ pkgbase = jka-toolkit
depends = unrar
depends = unzip
depends = zip
depends = facter
provides = jkazip
provides = apw
options = !emptydirs
source = https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz
md5sums = 2f2d776a4201f0628cae8c0ea0e12d22
md5sums = e03abc17bdceffedd0176258613a46b8
pkgname = jka-toolkit

View File

@@ -1,17 +1,17 @@
# Maintainer: JKA Network (JoseluCross, Kprkpr, Yukialba) <contacto@jkanetwork.com>
pkgname=jka-toolkit
pkgver=0.2.5
pkgrel=2
pkgver=0.2.6
pkgrel=1
pkgdesc="Set of scripts to optimize the daily work in linux shell (jkazip and apw)"
arch=('any')
url="http://proyecto.jkanetwork.com"
license=('GPL3')
depends=('p7zip' 'unrar' 'unzip' 'zip' 'facter')
depends=('p7zip' 'unrar' 'unzip' 'zip')
provides=('jkazip' 'apw')
options=(!emptydirs)
install=$pkgname.install
source=(https://gitlab.com/JKANetwork/jka-toolkit/raw/master/jka-toolkit.tar.gz)
md5sums=('2f2d776a4201f0628cae8c0ea0e12d22')
md5sums=('e03abc17bdceffedd0176258613a46b8')
package() {
cd "$srcdir/$pkgname"