-
Notifications
You must be signed in to change notification settings - Fork 5
/
create-rat-pkg.sh
executable file
·68 lines (51 loc) · 1.57 KB
/
create-rat-pkg.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 [package name] [package pretty name] [vulkan driver lib name] [architecture] [version] [category] [destdir-pkg] [output folder]"
echo ""
}
symlink2sh() {
for folder in $(find $1 -type d); do
if [ -d "$folder" ]; then
cd "$folder"
for file in $(find $PWD -type l); do
target=$(readlink $file)
if [ "$target" != "nul" ]; then
rm "$file"
target=$(echo $target | sed "s@$WORKDIR@$APP_ROOT_DIR@g")
file=$(echo $file | sed "s@$WORKDIR@$APP_ROOT_DIR@g")
echo "ln -sf $target $file" >> $WORKDIR/makeSymlinks.sh
fi
done
cd $OLDPWD
fi
done
}
export INIT_DIR=$PWD
export APP_ROOT_DIR=/data/data/com.micewine.emu/
export PACKAGE_NAME=$1
export PACKAGE_PRETTY_NAME=$2
export PACKAGE_VK_DRIVER_LIB=$3
export PACKAGE_ARCHITECTURE=$4
export PACKAGE_VERSION=$5
export PACKAGE_CATEGORY=$6
export DESTDIR_PKG=$7
export OUTDIR=$8
if [ $# -lt 8 ]; then
showHelp
exit 0
fi
echo ""
echo "Creating Package '$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_ARCHITECTURE.rat'..."
export WORKDIR="$DESTDIR_PKG"
if [ -d "$DESTDIR_PKG/data/" ]; then
WORKDIR="$DESTDIR_PKG/data/data/com.micewine.emu/"
fi
cd $WORKDIR
echo "name=$PACKAGE_PRETTY_NAME" > pkg-header
echo "category=$PACKAGE_CATEGORY" >> pkg-header
echo "version=$PACKAGE_VERSION" >> pkg-header
echo "architecture=$PACKAGE_ARCHITECTURE" >> pkg-header
echo "vkDriverLib=$PACKAGE_VK_DRIVER_LIB" >> pkg-header
symlink2sh "files/"
7z -tzip -mx=5 a "$OUTDIR/$PACKAGE_NAME-$PACKAGE_VERSION-$PACKAGE_ARCHITECTURE.rat" &> /dev/zero