blue-recorder/packaging/appimage/blue-recorder-appimage.sh

139 lines
4.4 KiB
Bash
Raw Normal View History

2021-06-10 15:47:18 +03:00
#!/bin/bash
libnslversion="2.27"
debpkg="libjack-jackd2-0_1.9.12~dfsg-2_amd64.deb"
2023-11-23 22:49:44 +03:00
debpkg2="libc6_2.27-3ubuntu1.6_amd64.deb"
2021-06-10 15:47:18 +03:00
#Download building tools.
2023-11-23 22:49:44 +03:00
if [[ -f /usr/bin/curl ]]
2021-06-10 15:47:18 +03:00
then
2023-11-23 22:49:44 +03:00
if [[ -f pkg2appimage-x86_64.AppImage ]]
2021-06-10 15:47:18 +03:00
then
2023-11-23 22:49:44 +03:00
echo "pkg2appimage-x86_64.AppImage found."
2021-06-10 15:47:18 +03:00
else
2023-11-23 22:49:44 +03:00
curl --tlsv1.3 --output "$PWD/pkg2appimage-x86_64.AppImage" --url "https://github.com/AppImage/pkg2appimage/releases/download/continuous/pkg2appimage-x86_64.AppImage"
#Make sure pkg2appimage is available.
if [[ -f pkg2appimage-x86_64.AppImage ]]
then
echo "pkg2appimage-x86_64.AppImage found."
else
echo "failed to download pkg2appimage-x86_64.AppImage" && exit 1
fi
2021-06-10 15:47:18 +03:00
fi
else
2023-11-23 22:49:44 +03:00
echo "please install curl." && exit 1
2021-06-10 15:47:18 +03:00
fi
if [[ -f appimagetool-x86_64.AppImage ]]
then
2023-11-23 22:49:44 +03:00
echo "appimagetool-x86_64.AppImage found."
2021-06-10 15:47:18 +03:00
else
2023-11-23 22:49:44 +03:00
curl --tlsv1.3 --output "$PWD/appimagetool-x86_64.AppImage" --url "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
#Make sure appimagetool is available.
if [[ -f appimagetool-x86_64.AppImage ]]
then
echo "appimagetool-x86_64.AppImage found."
else
echo "failed to download appimagetool-x86_64.AppImage" && exit 1
fi
2021-06-10 15:47:18 +03:00
fi
#Make exec.
2023-11-23 22:49:44 +03:00
chmod +x pkg2appimage-x86_64.AppImage
2021-06-10 15:47:18 +03:00
chmod +x appimagetool-x86_64.AppImage
#Create BlueRecorder.yml file.
2023-11-23 22:49:44 +03:00
echo "create BlueRecorder.yml"
2021-06-10 15:47:18 +03:00
cat > BlueRecorder.yml <<EOF
app: BlueRecorder
ingredients:
dist: bionic
packages:
- ffmpeg
- x11-utils
- pulseaudio
script:
- mkdir -p BlueRecorder.AppDir/usr/bin
- git clone https://github.com/xlmnxp/blue-recorder.git
- cd blue-recorder
- cargo build --release
- cd ..
- cp -r "blue-recorder/po/" "BlueRecorder.AppDir/usr/bin/po/"
- cp -r "blue-recorder/interfaces/" "BlueRecorder.AppDir/usr/bin/interfaces/"
- cp -r "blue-recorder/data/" "BlueRecorder.AppDir/usr/bin/data/"
- cp "blue-recorder/target/release/blue-recorder" "BlueRecorder.AppDir/usr/bin/blue-recorder"
- cd BlueRecorder.AppDir
- ln -s "usr/bin/data/blue-recorder.svg" "blue-recorder.svg"
sources:
- deb http://ly.archive.ubuntu.com/ubuntu/ bionic main universe
script:
- cat > blue-recorder.desktop <<EOF
- [Desktop Entry]
- Type=Application
- Name=Blue Recorder
- Icon=blue-recorder
- Exec=blue-recorder
- Categories=AudioVideo;GTK;
- Comment=A simple desktop recorder for Linux systems. Built using GTK+ 3 and ffmpeg.
- EOF
EOF
#Building AppImage using pkg2appimage.
2023-11-23 22:49:44 +03:00
echo "Building appimage directory..."
"$PWD/pkg2appimage-x86_64.AppImage" BlueRecorder.yml
2021-06-10 15:47:18 +03:00
rm -rf "$PWD/out"
#Installing libjack to AppDir.
if [[ -f $debpkg ]]
then
2023-11-23 22:49:44 +03:00
echo "$debpkg found."
2021-06-10 15:47:18 +03:00
else
2023-11-23 22:49:44 +03:00
apt download libjack-jackd2-0
if [[ -f $debpkg ]]
then
echo "$debpkg found."
else
echo "failed to download $debpkg" && exit 1
fi
2021-06-10 15:47:18 +03:00
fi
2023-11-23 22:49:44 +03:00
dpkg-deb -x "$debpkg" "$PWD"
2021-06-10 15:47:18 +03:00
mkdir -p "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/"
cp "usr/lib/x86_64-linux-gnu/libjack.so.0" "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/libjack.so.0"
2023-11-23 22:49:44 +03:00
#cp "usr/lib/x86_64-linux-gnu/libjack.so.0.1.0" "BlueRecorder/BlueRecorder.AppDirusr/lib/x86_64-linux-gnu/libjack.so.0.1.0"
2021-06-10 15:47:18 +03:00
cp "usr/lib/x86_64-linux-gnu/libjacknet.so.0" "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/libjacknet.so.0"
cp "usr/lib/x86_64-linux-gnu/libjacknet.so.0.1.0" "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/libjacknet.so.0.1.0"
cp "usr/lib/x86_64-linux-gnu/libjackserver.so.0" "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/libjackserver.so.0"
cp "usr/lib/x86_64-linux-gnu/libjackserver.so.0.1.0" "BlueRecorder/BlueRecorder.AppDir/usr/lib/x86_64-linux-gnu/libjackserver.so.0.1.0"
#Installing libnsl to AppDir.
if [[ -f $debpkg2 ]]
then
2023-11-23 22:49:44 +03:00
echo "$debpkg2 found."
2021-06-10 15:47:18 +03:00
else
2023-11-23 22:49:44 +03:00
apt download libc6
if [[ -f $debpkg2 ]]
then
echo "$debpkg2 found."
else
echo "failed to download $debpkg2" && exit 1
fi
2021-06-10 15:47:18 +03:00
fi
2023-11-23 22:49:44 +03:00
dpkg-deb -x "$debpkg2" "$PWD"
2021-06-10 15:47:18 +03:00
mkdir -p "BlueRecorder/BlueRecorder.AppDir/lib/x86_64-linux-gnu/"
cp "lib/x86_64-linux-gnu/libnsl.so.1" "BlueRecorder/BlueRecorder.AppDir/lib/x86_64-linux-gnu/libnsl.so.1"
cp "lib/x86_64-linux-gnu/libnsl-$libnslversion.so" "BlueRecorder/BlueRecorder.AppDir/lib/x86_64-linux-gnu/libnsl-$libnslversion.so"
#Building AppImage using appimagetool.
2023-11-23 22:49:44 +03:00
echo "Building appimage..."
2021-06-10 15:47:18 +03:00
"$PWD/appimagetool-x86_64.AppImage" "BlueRecorder/BlueRecorder.AppDir"
rm -rf "$PWD/BlueRecorder/blue-recorder"
2023-11-23 22:49:44 +03:00
echo "Finish building."