mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
WIP ubuntu appimage runner
This commit is contained in:
parent
e5215a838e
commit
fc7ff0bee4
3 changed files with 122 additions and 5 deletions
114
.github/workflows/build_appimage_bundle.yml
vendored
Normal file
114
.github/workflows/build_appimage_bundle.yml
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
name: Build and Release APPIMAGE Installer
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- name: Electron Builder
|
||||||
|
working-directory: gui
|
||||||
|
run: |
|
||||||
|
npm i
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: LIST ALL FILES
|
||||||
|
run: ls -R
|
||||||
|
|
||||||
|
- name: Install Python dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Build binaries
|
||||||
|
working-directory: modem
|
||||||
|
run: |
|
||||||
|
python3 -m nuitka --remove-output --assume-yes-for-downloads --follow-imports --include-data-dir=lib=lib --include-data-files=lib/codec2/*=lib/codec2/ --include-data-files=config.ini.example=config.ini --standalone server.py --output-filename=freedata-server
|
||||||
|
|
||||||
|
- name: Prepare AppImage folder
|
||||||
|
run: |
|
||||||
|
mkdir -p $HOME/freedata-appimage
|
||||||
|
|
||||||
|
- name: Copy GUI
|
||||||
|
run: |
|
||||||
|
cp -r gui/release/linux-unpacked/* $HOME/freedata-appimage/gui
|
||||||
|
|
||||||
|
|
||||||
|
- name: Copy server
|
||||||
|
run: |
|
||||||
|
cp -r modem/server.dist/* $HOME/freedata-appimage/server
|
||||||
|
|
||||||
|
- name: Copy Icon
|
||||||
|
run: |
|
||||||
|
cp gui/build/icon.png $HOME/freedata-appimage/icon.png
|
||||||
|
|
||||||
|
- name: Create Desktop shortcut
|
||||||
|
run: |
|
||||||
|
#
|
||||||
|
echo '
|
||||||
|
# Create desktop file
|
||||||
|
echo "[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=FreeDATA
|
||||||
|
Icon=icon
|
||||||
|
Exec=AppRun
|
||||||
|
Categories=Utility ' > $HOME/freedata-appimage/FreeDATA.desktop
|
||||||
|
|
||||||
|
- name: Create AppImage build script
|
||||||
|
run: |
|
||||||
|
echo '#!/bin/bash
|
||||||
|
# Navigate to the AppDir root; this ensures relative paths work as expected
|
||||||
|
cd "$(dirname "$(readlink -f "${0}")")"
|
||||||
|
|
||||||
|
# check if config exists in ~/.config/FreeDATA/config.ini else create it
|
||||||
|
SERVER_CONFIG_FILE=~/.config/FreeDATA/config.ini
|
||||||
|
if test -f "$SERVER_CONFIG_FILE"; then
|
||||||
|
echo "$SERVER_CONFIG_FILE exists."
|
||||||
|
else
|
||||||
|
echo "$SERVER_CONFIG_FILE does not exist. Copying the default one"
|
||||||
|
mkdir ~/.config/FreeDATA
|
||||||
|
cp server.dist/config.ini $SERVER_CONFIG_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FREEDATA_CONFIG=$SERVER_CONFIG_FILE
|
||||||
|
|
||||||
|
# Launch the main application executable from the linux-unpacked directory
|
||||||
|
./linux-unpacked/freedata
|
||||||
|
|
||||||
|
' > $HOME/AppRun
|
||||||
|
chmod +x $HOME/freedata-appimage/AppRun
|
||||||
|
|
||||||
|
- name: Download AppImage
|
||||||
|
run: |
|
||||||
|
wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool-x86_64.AppImage
|
||||||
|
chmod +x appimagetool-x86_64.AppImage
|
||||||
|
|
||||||
|
- name: Execute AppImage
|
||||||
|
run: |
|
||||||
|
./appimagetool-x86_64.AppImage freedata-appimage/
|
||||||
|
|
||||||
|
- name: LIST ALL FILES
|
||||||
|
run: ls -R
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'FreeDATA-x86_64.AppImage'
|
||||||
|
path: ./$HOME/FreeDATA-x86_64.AppImage
|
||||||
|
|
||||||
|
- name: Upload Installer to Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
files: ./$HOME/FreeDATA-x86_64.AppImage
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
name: 'FreeDATA-x86_64.AppImage'
|
|
@ -111,11 +111,12 @@ app.whenReady().then(() => {
|
||||||
//serverProcess = spawn(serverPath, [], { detached: true });
|
//serverProcess = spawn(serverPath, [], { detached: true });
|
||||||
//serverProcess.unref(); // Allow the server process to continue running independently of the parent process
|
//serverProcess.unref(); // Allow the server process to continue running independently of the parent process
|
||||||
// break;
|
// break;
|
||||||
//case "linux":
|
case "linux":
|
||||||
//serverPath = join(basePath, "freedata-server", "freedata-server.exe");
|
serverPath = join(basePath, "server.dist", "freedata-server");
|
||||||
//serverProcess = spawn(serverPath, [], { detached: true });
|
console.log(`Starting server with path: ${serverPath}`);
|
||||||
//serverProcess.unref(); // Allow the server process to continue running independently of the parent process
|
serverProcess = spawn(serverPath, [], { detached: true });
|
||||||
// break;
|
serverProcess.unref(); // Allow the server process to continue running independently of the parent process
|
||||||
|
break;
|
||||||
case "win32":
|
case "win32":
|
||||||
serverPath = join(basePath, "freedata-server", "freedata-server.exe");
|
serverPath = join(basePath, "freedata-server", "freedata-server.exe");
|
||||||
console.log(`Starting server with path: ${serverPath}`);
|
console.log(`Starting server with path: ${serverPath}`);
|
||||||
|
|
|
@ -13,6 +13,8 @@ class DatabaseManager:
|
||||||
def __init__(self, event_manger, db_file=None):
|
def __init__(self, event_manger, db_file=None):
|
||||||
self.event_manager = event_manger
|
self.event_manager = event_manger
|
||||||
if not db_file:
|
if not db_file:
|
||||||
|
print(os.environ)
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
db_path = os.path.join(script_dir, 'freedata-messages.db')
|
db_path = os.path.join(script_dir, 'freedata-messages.db')
|
||||||
db_file = 'sqlite:///' + db_path
|
db_file = 'sqlite:///' + db_path
|
||||||
|
|
Loading…
Reference in a new issue