-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxil
152 lines (130 loc) · 3.02 KB
/
xil
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
# XIL: XBPS Interpeter Layer: Utility that makes basic XBPS commands more sane
# Copyright (c) James Gillman [[email protected]], gitlab: @safetypanda
# See https://github.com/void-linux for more info on Void Linux & XBPS
# Released under the GNU General Public License version 3+
# Refer to LICENSE file for license information.
version="1.0"
version()
{
echo "*----------------------------------------------------------------*"
echo " XIL: XBPS Interpeter Layer Version $version"
echo " James Gillman [[email protected]] gitlab: @safetypanda"
echo ""
echo " Current XBPS version: $(xbps-query -v --version)"
echo ""
echo " XIL Copyright (C) 2019 James Gillman"
echo " This program comes with ABSOLUTELY NO WARRANTY;"
echo " This is free software, and you are welcome to redistribute it "
echo " under certain conditions. Refer to included GNU License!"
echo "*----------------------------------------------------------------*"
echo ""
}
usage()
{
echo ""
echo "usage: xil [OPTIONS] [<ARGUMENTS>]"
echo ""
echo "Options:"
echo "update -> Update Repos"
echo "upgrade -> Upgrade System"
echo "listrepos -> Lists all configured Repos"
echo "addrepo <ARGS> -> Adds a Repository"
echo "search <NAME> -> Searches for packages using a name"
echo "install <PKG(s)> -> Installs package(s)"
echo "remove <PKG(s)> -> Removes package(s)"
echo "recursiveremove -> Removes package(s) and it's dependencies"
echo "autoremove -> Removes orphaned packages"
echo "help -> Shows this dialog"
echo "details -> Shows version, contact and license info"
echo ""
}
privCheck ()
{
if [[ "$EUID" -gt 0 ]]; then
echo "ERROR: This operation requires escalated privileges. Exiting!"
exit 1
fi
}
arg="$1"
if [ -z $arg ]
then
echo "ERROR: Options missing, try --help."
echo "usage: xil [OPTIONS] [<ARGUMENTS>]"
exit 2
fi
case "$arg" in
update)
shift
privCheck
echo ""
xbps-install -S
;;
help|--help)
usage
;;
upgrade)
shift
privCheck
echo ""
xbps-install -Suv
;;
listrepos)
echo ""
xbps-query -v -L
;;
addrepo)
shift
privCheck
while [ "$#" -gt 0 ]; do
echo ""
xbps-install "$1"
done
;;
search)
shift
echo ""
xbps-query -Rs "$@"
;;
install)
shift
privCheck
if [ "$#" -lt 1 ]; then
echo "ERROR: Argument missing, try --help."
exit 1
fi
xbps-install -S "$@"
;;
remove)
shift
privCheck
if [ "$#" -lt 1 ]; then
echo "ERROR: Argument missing, try --help."
exit 1
fi
echo ""
xbps-remove "$@"
;;
recursiveremove)
shift
privCheck
if [ "$#" -lt 1 ]; then
echo "ERROR: argument missing, try --help."
exit 1
fi
xbps-remove -R "$@"
;;
autoremove)
shift
privCheck
xbps-remove -O
;;
details)
version
;;
*)
echo "ERROR: Not a valid command, try --help"
exit 1
;;
esac
exit 0