This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgibi.sh
119 lines (105 loc) · 2.41 KB
/
gibi.sh
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
#!/bin/bash
# Git based innovative package manager written in bash 5.1.16 - a part of ByCh4n's multi Hack Tool kit
# Copyright (C) 2023 ByCh4n&lazypwny751
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# TODO:
# - add http 2 https converter for curl.
# - add policy kit (sudo, doas, pkexec) for now we're using sudo but we will fix it.
# - make implemented source manager.
set -e
# Define variables and functions
export status="true" CWD="${PWD}"
export LIBDIR="${CWD}/lib"
if [[ -z "${GIBIDIR}" ]] ; then
export GIBIDIR="${CWD}/packages"
fi
export require_cmd=(
"chmod"
"mkdir"
"rmdir"
"find"
"awk"
"git"
"cp"
"rm"
"ln"
)
export require_lib=(
"base"
"argp"
"parser"
"version"
"osutils"
"install"
"init"
)
export entites=(
"${CWD}/lib"
"${CWD}/lib/argp.sh"
"${CWD}/lib/init.sh"
"${CWD}/lib/base.sh"
"${CWD}/lib/parser.sh"
"${CWD}/lib/version.sh"
"${CWD}/lib/osutils.sh"
"${CWD}/lib/install.sh"
)
readonly CWD LIBDIR
for _file_ in "${require_lib[@]}" ; do
if [[ -f "${LIBDIR}/${_file_}.sh" ]] ; then
source "${LIBDIR}/${_file_}.sh"
elif [[ -f "${LIBDIR}/${_file_}" ]] ; then
source "${LIBDIR}/${_file_}"
else
echo -e "file not found: \"${_file_##*/}\"."
export status="false"
fi
done
if ! ${status} ; then
exit 1
fi
# Parsing parameters and initialize the tool.
init:gibi
trap on:exit INT
readonly GIBIDIR
while [[ "${#}" -gt 0 ]] ; do
case "${1}" in
"--"[iI][nN][sS][tT][aA][lL][lL]|"-"[iI][nN])
export OPT="install"
shift
;;
"--"[uU][nN][iI][nN][sS][tT][aA][lL][lL]|"-"[uU][nN])
export OPT="uninstall"
shift
;;
*)
export OPTARG+=("${1}")
shift
;;
esac
done
# Processing the option.
case "${OPT}" in
"install")
set +e
install:install "${OPTARG[@]}"
;;
"uninstall")
set +e
;;
*)
echo "${0##*/}: unknown option: \"${OPTION}\"."
exit 1
;;
esac