-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathibuild.sh
executable file
·55 lines (48 loc) · 1.36 KB
/
ibuild.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
#!/bin/bash
###########################
## instantOS build tools ##
###########################
# this script is the main wrapper
if ! [ -e /usr/local/share/instanttools ]; then
if [ -e "$PREFIX/share/instanttools" ]; then
TOOLS="$PREFIX/share/instanttools"
else
echo "ibuild not installed correctly"
exit
fi
else
TOOLS="/usr/local/share/instanttools"
fi
if [ -z "$1" ]; then
SCRIPT="$(ls "$TOOLS/" | grep -o '[^/]*$' | grep -o '^[^.]*' | fzf | head -1)"
else
if [ "$1" = '--help' ] || [ "$1" = "-h" ]; then
cd "$TOOLS" || exit 1
echo 'usage: ibuild command [options]'
echo 'commands:'
echo ''
cat "$TOOLS/helpcache.txt"
exit
fi
if [ -e "$TOOLS/$1.sh" ]; then
SCRIPT="$1"
else
SLIST="$(ls "$TOOLS/" | grep "^$1")"
if [ -n "$SLIST" ]; then
if wc -l <<<"$SLIST" | grep -o '^1$'; then
SCRIPT="$(echo "$SLIST" | grep -o '[^/]*$' | grep -o '^[^.]*')"
else
SCRIPT="$(ls "$TOOLS/" | grep "^$1" | grep -o '[^/]*$' | grep -o '^[^.]*' | fzf | head -1)"
fi
else
echo "no match found for $1"
exit
fi
fi
shift 1
fi
[ -z "$SCRIPT" ] && exit
if command -v idate &>/dev/null && idate w ibuildupdate; then
ibuild upgrade
fi
"$TOOLS/$SCRIPT.sh" "$@"