-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThePAK
81 lines (68 loc) · 1.57 KB
/
ThePAK
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
#!/usr/bin/env bash
source etc/banner
# Banner Add
echo -e "executing: ${LIGHTGREEN}ThePAK${NOCOLOR}"
echo "-----------------------"
if [[ -d "output" ]]
then
echo ""
else
echo ""
mkdir output
fi
unpacking () {
qemu-i386 $PREFIX/share/quickbms/quickbms -Q etc/tools.bms $opt output
}
repacking () {
qemu-i386 $PREFIX/share/quickbms/quickbms -w -r -r etc/tools.bms $opt output
}
function unpack {
prompt="Please select a file to unpack:"
options=( $(find *.pak) )
PS3="$prompt "
select opt in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "You picked $opt which is file $REPLY"
unpacking
break
else
echo "Invalid option. Try another one."
fi
done
}
function repack {
prompt="Please select a file to repack:"
options=( $(find *.pak) )
PS3="$prompt "
select opt in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "You picked $opt which is file $REPLY"
repacking
break
else
echo "Invalid option. Try another one."
fi
done
}
PS3='Please enter your choice: '
options=("Unpack" "Repack" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Unpack")
unpack
break
;;
"Repack")
repack
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done