Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
Add Linux installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Erriez committed Apr 10, 2023
1 parent 6af566e commit 332af4a
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Exclude the following files to make this a Python project
*.sh linguist-vendored=true
*.nsi linguist-vendored=true
37 changes: 32 additions & 5 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Save version.txt
run: |
echo "v${{steps.tag.outputs.tag}}" > data/version.txt
echo "${{steps.tag.outputs.tag}}" > data/version.txt
echo "Contents data/version.txt:"
cat data/version.txt
Expand All @@ -84,11 +84,31 @@ jobs:
onefile: true
enable-plugins: pyside6

- name: Create Linux installer
run: |
# Install Linux system dependencies
sudo apt install makeself
# Copy executable to installer directory
cp erriez-pyside6-app-linux installer-linux/program/erriez-pyside6-app
# Create Linux installer
OUTPUT_FILE=erriez-pyside6-app-linux-setup.run
installer-linux/create_linux_installer.sh ${OUTPUT_FILE}
# Check if file exists
if [ ! -f "$OUTPUT_FILE" ]; then
echo "OUTPUT_FILE does not exist."
exit 1
fi
- name: Create executable hashes
run: |
sha1sum erriez-pyside6-app-linux > erriez-pyside6-app-linux.sha1
sha1sum erriez-pyside6-app-linux-setup.run > erriez-pyside6-app-linux-setup.run.sha1
cat erriez-pyside6-app-linux.sha1
cat erriez-pyside6-app-linux-setup.run.sha1
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -99,6 +119,8 @@ jobs:
website.url
erriez-pyside6-app-linux
erriez-pyside6-app-linux.sha1
erriez-pyside6-app-linux-setup.run
erriez-pyside6-app-linux-setup.run.sha1
build-windows:
runs-on: windows-latest
Expand All @@ -112,8 +134,8 @@ jobs:
uses: Erriez/action-get-tag@v1.0.1
with:
strip_v: true # Remove v character from version
default: v0.0.0 # Default version when tag not found
default: 0.0.0 # Default version when tag not found

- name: Setup Python
uses: actions/setup-python@v4
with:
Expand All @@ -129,7 +151,7 @@ jobs:
- name: Save version.txt
run: |
echo "v${{steps.tag.outputs.tag}}" > data\version.txt
echo "${{steps.tag.outputs.tag}}" > data\version.txt
echo "Contents data\version.txt:"
cat data\version.txt
Expand All @@ -154,6 +176,9 @@ jobs:

- name: Create Windows NSIS installer
uses: joncloud/makensis-action@v4
with:
script-file: "install.nsi"
arguments: "/V4 /DVERSION=${{steps.tag.outputs.tag}}"

- name: Create executable hashes
run: |
Expand Down Expand Up @@ -201,6 +226,8 @@ jobs:
LICENSE
${{ github.workspace }}/artifacts/Linux Build/erriez-pyside6-app-linux
${{ github.workspace }}/artifacts/Linux Build/erriez-pyside6-app-linux.sha1
${{ github.workspace }}/artifacts/Linux Build/erriez-pyside6-app-linux-setup.run
${{ github.workspace }}/artifacts/Linux Build/erriez-pyside6-app-linux-setup.run.sha1
${{ github.workspace }}/artifacts/Windows Build/erriez-pyside6-app.exe
${{ github.workspace }}/artifacts/Windows Build/erriez-pyside6-app.exe.sha1
${{ github.workspace }}/artifacts/Windows Build/erriez-pyside6-app-setup.exe
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Changelog

## v1.0.4

Add Linux installer.
Add SHA1 file checksums.
Add argument parser.

## v1.0.3

Add Git tag version
Add Git tag version.

## v1.0.2

Expand Down
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,28 @@ Download executables for Windows or Linux from:
* [Github Actions (development)](https://github.com/Erriez/pyside6-nuitka-test/actions), open
a build and download `Linux Build` or `Windows Build` under `Artifacts`.

**On Linux:**
**Linux installer:**

No `sudo` rights are required as the executable is installed in the user's home directory `~/.local/bin/erriez/`:

```bash
# Add executable flag after download with command:
$ chmod +x erriez-pyside6-app-linux-setup.run

# Run setup:
$ ./erriez-pyside6-app-linux-setup.run

Press `q` to quit license.
Please type y to accept, n otherwise: y
...
```

Start the application via desktop menu | Accessories.

**Linux standalone application:**

The Linux standalone executable can be started directly without `sudo` or installation:

```bash
# Add executable flag after download with command:
$ chmod +x erriez-pyside6-app
Expand All @@ -32,9 +53,10 @@ $ chmod +x erriez-pyside6-app
$ ./erriez-pyside6-app
```

**On Windows:**:
**Windows:**:
* Run `erriez-pyside6-app.exe` as portable standalone application, or:
* Run `erriez-pyside6-app-setup.exe` to install on Windows which creates a shortcut in the start menu and desktop:
* Run `erriez-pyside6-app-setup.exe` to install on Windows (default: `C:\Program Files\Erriez\`) which creates a
shortcut in the start menu and desktop:

## Build executable manually

Expand Down Expand Up @@ -117,8 +139,8 @@ $ ./pyside6-app-linux
```

## Build Windows MSI manually
- Download [NSIS v3](https://nsis.sourceforge.io/Download)
- Download [NSIS Quick Setup Script Generator](https://nsis.sourceforge.io/NSIS_Quick_Setup_Script_Generator)
- Download [NSIS v3](https://nsis.sourceforge.io/Download).
- Download [NSIS Quick Setup Script Generator](https://nsis.sourceforge.io/NSIS_Quick_Setup_Script_Generator).
- Start `NSIS Quick Setup Script Generator.exe` and fill-in the wizard.
- Copy generated file from `Output\App\*.nsi` to install.nsi and change to
- relative path / customize.
Expand Down
6 changes: 4 additions & 2 deletions install.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
!define APP_NAME "Erriez PySide6 App"
!define COMP_NAME "Erriez Open Source Software"
!define WEB_SITE "https://github.com/Erriez"
!define VERSION "01.00.02.00"
!ifndef VERSION
!define VERSION "0.0.0"
!endif
!define COPYRIGHT "Erriez © 2023"
!define DESCRIPTION "Application"
!define LICENSE_TXT "LICENSE"
Expand All @@ -20,7 +22,7 @@

######################################################################

VIProductVersion "${VERSION}"
VIProductVersion "${VERSION}.0"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "CompanyName" "${COMP_NAME}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
Expand Down
16 changes: 16 additions & 0 deletions installer-linux/create_linux_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/bash

SCRIPT_PATH=$(dirname -- ${BASH_SOURCE[0]})

INPUT_DIR=${SCRIPT_PATH}/program
LICENSE_FILE=${INPUT_DIR}/LICENSE
OUTPUT_FILE=$1
LABEL="Erriez PySide6 App"

echo "Creating Linux installer"
makeself --sha256 --license ${LICENSE_FILE} ${INPUT_DIR} ${OUTPUT_FILE} "${LABEL}" ./install.sh

echo "Created installer:"
./${OUTPUT_FILE} --check
./${OUTPUT_FILE} --info
./${OUTPUT_FILE} --list
21 changes: 21 additions & 0 deletions installer-linux/program/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Erriez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions installer-linux/program/erriez-pyside6-app.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=Erriez Pyside6 App
GenericName=Erriez Pyside6 App
Comment=A PySide6 example application created by Erriez
Icon=
Exec=
Categories=PySide6;Utility;
Keywords=Erriez;PySide6;
Terminal=false
MimeType=application/erriez-pyside6-app;
46 changes: 46 additions & 0 deletions installer-linux/program/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/bash

APP_EXE=erriez-pyside6-app
APP_LICENSE=LICENSE
APP_UNINSTALL=uninstall.sh
APP_ICO=pyside6.ico
APP_SHORTCUT=${APP_EXE}.desktop
APP_DEVELOPER=erriez

EXE_PATH=$HOME/.local/bin/${APP_DEVELOPER}
ICON_PATH=$HOME/.local/share/icons
SHORTCUT_PATH=$HOME/.local/share/applications

DST_EXE_FILE=${EXE_PATH}/${APP_EXE}
DST_LICENSE_FILE=${EXE_PATH}/${APP_LICENSE}
DST_UNINSTALL_FILE=${EXE_PATH}/${APP_UNINSTALL}
DST_ICON_FILE=${ICON_PATH}/${APP_ICO}
DST_SHORTCUT_FILE=${SHORTCUT_PATH}/${APP_SHORTCUT}

# Start installation
echo "Installing ${APP_EXE}..."

# Create directories
mkdir -p ${EXE_PATH}
mkdir -p ${ICON_PATH}
mkdir -p ${SHORTCUT_PATH}

# Copy files
cp ${APP_EXE} ${DST_EXE_FILE}
cp ${APP_LICENSE} ${DST_LICENSE_FILE}
cp ${APP_UNINSTALL} ${DST_UNINSTALL_FILE}
cp ${APP_ICO} ${DST_ICON_FILE}
cp ${APP_SHORTCUT} ${DST_SHORTCUT_FILE}

# Make executable
chmod +x ${DST_EXE_FILE}
chmod +x ${DST_UNINSTALL_FILE}
chmod +x ${DST_SHORTCUT_FILE}

# Replace Icon= and Exec= with absolute path in .desktop shortcut
sed -i "s_Icon=_Icon=${DST_ICON_FILE}_g" ${DST_SHORTCUT_FILE}
sed -i "s_Exec=_Exec=${DST_EXE_FILE} %f_g" ${DST_SHORTCUT_FILE}

echo "Application installed in: ${EXE_PATH}"
echo "Run uninstall.sh in the install directory to uninstall."
echo "Installation completed"
Binary file added installer-linux/program/pyside6.ico
Binary file not shown.
23 changes: 23 additions & 0 deletions installer-linux/program/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/bash

APP_EXE=erriez-pyside6-app
APP_UNINSTALL=uninstall.sh
APP_ICO=pyside6.ico
APP_SHORTCUT=${APP_EXE}.desktop
APP_DEVELOPER=erriez

EXE_PATH=$HOME/.local/bin/${APP_DEVELOPER}
ICON_PATH=$HOME/.local/share/icons
SHORTCUT_PATH=$HOME/.local/share/applications

DST_EXE_FILE=${EXE_PATH}/${APP_EXE}
DST_UNINSTALL_FILE=${EXE_PATH}/${APP_UNINSTALL}
DST_ICON_FILE=${ICON_PATH}/${APP_ICO}
DST_SHORTCUT_FILE=${SHORTCUT_PATH}/${APP_SHORTCUT}

# Remove files and directories
rm -r ${EXE_PATH}
rm ${DST_ICON_FILE}
rm ${DST_SHORTCUT_FILE}

echo "Uninstall completed"

0 comments on commit 332af4a

Please sign in to comment.