-
Notifications
You must be signed in to change notification settings - Fork 1
/
solt_functions
executable file
·57 lines (47 loc) · 1.15 KB
/
solt_functions
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
#!/bin/bash
# Load all the basch scripts
for file in /usr/share/solt/*; do
source /usr/share/solt/solt_log
done
if [ -f "/etc/solt/solt.conf" ]; then
source /etc/solt/solt.conf
fi
# Checks if the folder already exists
function _file_check {
if [ -z "$reponame" ]; then
_show_error "Please input package file name."
exit 5
elif [ -d "$@" ]; then
_show_error "Directory already exists."
exit 17
fi
}
# Checks if you have root privileges
function _root_check {
if [[ "$(id -u)" != "0" ]]; then
_show_error "This operation requires admin privileges"
exit 87
fi
}
# Checks if you have root privileges
function _user_check {
if [[ "$(id -u)" = "0" ]]; then
_show_error "This operation should be run as user"
exit 87
fi
}
# Check which shell its using and executes it
function _exec_shell {
if [[ $(echo $0) = "bash" || "/bin/bash" ]] ; then
exec bash
elif [[ $(echo $0) = "zsh" || "/bin/zsh" ]]; then
exec zsh
fi
}
# kill output of pushd/popd
pushd () {
command pushd "$@" > /dev/null
}
popd () {
command popd "$@" > /dev/null
}