1
0
mirror of https://gitlab.com/JKANetwork/jka-toolkit.git synced 2026-02-28 16:03:47 +01:00
This commit is contained in:
2016-05-24 19:19:58 +00:00
parent 8428ce90af
commit 363d185f01

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# apw, a simple packager wrapper for Arch, Debian, RedHat/Fedora, and Suse (And all his derivates)
# It simplifies the process of remembering pacman,apt, etc , all in one, apw
# 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
@@ -18,14 +18,14 @@ 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 "apw - A Packager Wrapper, a Idea from JKA Network, version 1.2"
echo " Usage: apw <option> [packages]"
echo " {-h | h} This help"
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, ej .deb , .pkg.tar.xz,...)"
echo " {-F | F} Install file (distro family dependent, e.g. .deb , .pkg.tar.xz,...)"
exit
;;
*U*)
@@ -50,6 +50,14 @@ 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)
@@ -61,13 +69,6 @@ do
packages="$packages $valtmp"
done
#Obligar 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
#Check if is dnf in RedHat, or apt in Debian, new tools
if [[ $SO = "RedHat" && ! -f /usr/bin/dnf ]];then
yum install dnf