-
Notifications
You must be signed in to change notification settings - Fork 8
/
cat-rat-pkgs.sh
executable file
·68 lines (49 loc) · 1.16 KB
/
cat-rat-pkgs.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
#!/bin/bash
showHelp()
{
echo "Usage: $0 [name] [version] [category] [architecture] [rat package 1] [rat package 2] ..."
echo ""
}
resolvePath()
{
if [ -f "$1" ]; then
echo "$1"
elif [ -f "$INIT_DIR/$1" ]; then
echo "$INIT_DIR/$1"
fi
}
getElementFromHeader()
{
echo "$(cat pkg-header | head -n $1 | tail -n 1 | cut -d "=" -f 2)"
}
export INIT_DIR=$PWD
export RAND_VAL=$RANDOM--
if [ $# -lt 6 ]; then
showHelp
exit 0
fi
mkdir -p /tmp/$RAND_VAL
cd /tmp/$RAND_VAL
mkdir -p "vulkanDrivers"
touch new_makeSymlinks.sh
for i in $*; do
resolvedPath=$(resolvePath "$i")
if [ -n "$resolvedPath" ]; then
echo "Extracting '$(basename $resolvedPath)'..."
7z -aoa e "$resolvedPath" pkg-header
packageCategory=$(getElementFromHeader 2)
if [ "$packageCategory" == "VulkanDriver" ]; then
cp -f "$resolvedPath" "vulkanDrivers"
else
7z -aoa x "$resolvedPath" &> /dev/zero
fi
if [ -f "makeSymlinks.sh" ]; then
cat makeSymlinks.sh >> new_makeSymlinks.sh
rm -f makeSymlinks.sh
fi
fi
done
mv new_makeSymlinks.sh makeSymlinks.sh
$INIT_DIR/create-rat-pkg.sh "$1" "MiceWine RootFS" "" "$4" "$2" "$3" "$PWD" "$INIT_DIR"
cd "$INIT_DIR"
rm -rf /tmp/$RAND_VAL