generated from CommonWealthRobotics/CaDoodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-linux_x64.sh
118 lines (97 loc) · 2.78 KB
/
package-linux_x64.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
#https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-fx-jdk17.0.11-linux_x64.tar.gz
# zulu17.50.19-ca-fx-jdk17.0.11-linux_x64
NAME=CaDoodle
VERSION=0.0.1
MAIN=com.commonwealthrobotics.Main
if [[ -z "${VERSION_SEMVER}" ]]; then
VERSION=4.0.4
else
VERSION="${VERSION_SEMVER}"
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export ARCH=x86_64
JVM=zulu17.50.19-ca-fx-jdk17.0.11-linux_x64
set -e
ZIP=$JVM.tar.gz
export JAVA_HOME=$HOME/bin/java17/
if test -d $JAVA_HOME/$JVM/; then
echo "$JAVA_HOME exists."
else
rm -rf $JAVA_HOME
mkdir -p $JAVA_HOME
wget https://cdn.azul.com/zulu/bin/$ZIP
tar -xvzf $ZIP -C $JAVA_HOME
mv $JAVA_HOME/$JVM/* $JAVA_HOME/
fi
./gradlew shadowJar
echo "Test jar in: $SCRIPT_DIR"
DIR=$SCRIPT_DIR/CaDoodleUpdater/build/libs/
INPUT_DIR="$SCRIPT_DIR/input"
JAR_NAME=CaDoodleUpdater.jar
#$JAVA_HOME/bin/java -jar $DIR/$JAR_NAME
echo "Test jar complete"
ls -al $JAVA_HOME
ICON=$NAME.png
cp SourceIcon.png $ICON
rm -rf $SCRIPT_DIR/$NAME
rm -rf $SCRIPT_DIR/$NAME.AppDir
BUILDDIR=CaDoodleUpdater/build/libs/
TARGETJAR=CaDoodleUpdater.jar
$JAVA_HOME/bin/jpackage --input $BUILDDIR \
--name $NAME \
--main-jar $TARGETJAR \
--main-class $MAIN \
--type app-image \
--app-version $VERSION \
--java-options '--enable-preview'
mkdir -p $SCRIPT_DIR/$NAME.AppDir/usr/
cp -r $SCRIPT_DIR/$NAME/* $SCRIPT_DIR/$NAME.AppDir/usr/
mkdir -p $NAME.AppDir/usr/share/applications
mkdir -p $NAME.AppDir/usr/share/icons/hicolor/256x256/apps
cat << EOF > $NAME.AppDir/$NAME.desktop
[Desktop Entry]
Name=$NAME
Exec=BowlerStudioUpdater-$ARCH.AppImage
Icon=$NAME
Type=Application
Categories=Utility
EOF
chmod 644 $NAME.AppDir/$NAME.desktop
ln -s usr/bin/$NAME $SCRIPT_DIR/$NAME.AppDir/AppRun
chmod 755 $SCRIPT_DIR/$NAME.AppDir/usr/bin/$NAME
chmod 755 $SCRIPT_DIR/$NAME.AppDir/AppRun
cp $ICON $NAME.AppDir/usr/share/icons/hicolor/256x256/apps/$NAME.png
cp $ICON $NAME.AppDir/$NAME.png
# Step 2: Install AppImageTool (done once)
TOOL=appimagetool-x86_64.AppImage
if test -f $TOOL; then
echo $TOOL exists
else
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/$TOOL
chmod +x $TOOL
fi
./$TOOL $NAME.AppDir
echo "Testing executable:"
#./$NAME-$ARCH.AppImage one two
echo "Building .deb..."
rm -rf *.deb
$JAVA_HOME/bin/jpackage --input $BUILDDIR \
--name $NAME \
--main-jar $TARGETJAR \
--main-class $MAIN \
--type deb \
--app-version $VERSION \
--linux-shortcut \
--icon $ICON \
--copyright "Creative Commons" \
--vendor CommonWealthRobotics \
--linux-menu-group "Education;Graphics;Development;" \
--java-options '--enable-preview'
echo "Deb built!"
ls -al
rm -rf release
mkdir release
cp *.deb release/$NAME-Linux-$ARCH.deb
cp $NAME-$ARCH.AppImage release/$NAME-Linux-$ARCH.AppImage
#sudo apt remove bowlerlauncher
#sudo dpkg -i *.deb