-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallpackage
executable file
·47 lines (40 loc) · 1.13 KB
/
installpackage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# vim: set ts=4 sw=4 st=4 expandtab :
# Copyright (c) 2017 Timothy Savannah - All Rights Reserved
# This code is licensed under the terms of the APACHE license version 2.0
#
#
# installpackage - Installs packages using shorthand notation.
# Useful in conjunction with makepkg and PKGBUILDs
#
print_help() {
echo "Usage:";
echo -e "\tinstallpackage - no args installs all packages in current directory.";
echo -e "\tinstallpackage [glob] - Installs all packages in current directory containing glob pattern (or subdirectory if glob contains '/')";
echo -e "\tinstallpackage -d [directory] - Installs all packages in specified directory";
}
if [ $# -gt 0 ] && [ "$1" == "--help" -o "$1" = "-h" -o "$1" = "-?" ];
then
print_help;
exit 0;
fi
if [ "`whoami`" != "root" ];
then
echo "Login as root: "
su root -c "$0 $@";
exit $?;
fi
if [ $# -eq 0 ];
then
pacman -U *.pkg.tar.xz;
elif [ $# -eq 1 ];
then
pacman -U *$1*.pkg.tar.xz;
elif [ $# -eq 2 ] && [ "$1" == "-d" ];
then
pacman -U "$2"/*.pkg.tar.xz;
else
print_help;
exit 1;
fi
# vim: set ts=4 sw=4 st=4 expandtab :