Skip to content

Commit 33a300d

Browse files
committed
Initial commit
0 parents  commit 33a300d

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.swp
2+
*AppDir*/
3+
*.AppImage*

LICENSE.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2021 TheAssassin, X0rg and the linuxdeploy contributors
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Collection of miscellaneous linuxdeploy plugins
2+
3+
This repository contains miscellaneous [linuxdeploy plugins](https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system). They're mostly written in plain bash (or even just Bourne shell).
4+
5+
6+
## Usage
7+
8+
```bash
9+
# get linuxdeploy
10+
> wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
11+
12+
# get some plugin
13+
> wget -c "https://raw.githubusercontent.com/linuxdeploy/misc-plugins/master/demo/linuxdeploy-plugin-demo.sh"
14+
15+
# first option: install your app into your AppDir via `make install` etc.
16+
# second option: bundle your app's main executables manually
17+
# see https://docs.appimage.org/packaging-guide/from-source/native-binaries.html for more information
18+
> [...]
19+
20+
# call through linuxdeploy
21+
> ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin demo --output appimage --icon-file mypackage.png --desktop-file mypackage.desktop
22+
```
23+
24+
25+
## Contributing new plugins
26+
27+
Plugins in this repository must be "download, make executable, run". That means that they must be written in script languages that are typically available on systems (e.g., bash). They must be able to run standalone (that means, making them executable and running them without linuxdeploy should yield some useful log). The files must respect the linuxdeploy [plugin naming](https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system#plugin-naming), and implement the [mandatory CLI parameters](https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system#mandatory-parameters).
28+
29+
Most of these plugins just call other tools on the system, install AppRun hooks, or perform other simple tasks. More complex ones should be moved into dedicated repositories.
30+
31+
Plugins may have dependencies on system tools. Ideally, these are commonly available (e.g., `readelf`). They should always check whether these are available, and either hard-fail (print error and exit), or warn the user and deactivate certain functionality if programs cannot be found in `$PATH`.
32+
33+
linuxdeploy can be expected to be available (`$LINUXDEPLOY` usually points to a working binary), and it can be used to perform certain tasks such as bundling additional binaries or libraries along with their dependencies.
34+
Even though `$LINUXDEPLOY` is set by linuxdeploy automatically, the plugin should always check for its existence (e.g., with `[ -x "$LINUXDEPLOY" ]`) and provide meaningful feedback.
35+
36+
The `demo` plugin is a very simple, minimal working example plugin. Please feel free to take it as an inspiration for your own plugins.
37+
38+
Only plugins with free software licenses (recognized by the OSI) are accepted into this repository. It is highly recommended to use the MIT license (the same license linuxdeploy and all official plugins use), but it's not mandatory. However, if your plugin uses a non-permissive license (e.g., a copyleft one), it might be rejected, depending on how it works.
39+
40+
41+
## Licensing
42+
43+
All plugin scripts reside in subdirectories of this repository, along with a README. If there is no LICENSE file next to the plugin script, the license in `LICENSE.txt` in the root directory of the repository applies.

demo/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# linuxdeploy-plugin-demo
2+
3+
This is a minimal demo of a linuxdeploy plugin written in plain bash. You can use it as a template for other plugins.
4+
5+
6+
## Usage
7+
8+
```bash
9+
# get linuxdeploy and linuxdeploy-plugin-demo
10+
> wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
11+
> wget -c "https://raw.githubusercontent.com/linuxdeploy/misc-plugins/master/demo/linuxdeploy-plugin-demo.sh"
12+
13+
# first option: install your app into your AppDir via `make install` etc.
14+
# second option: bundle your app's main executables manually
15+
# see https://docs.appimage.org/packaging-guide/from-source/native-binaries.html for more information
16+
> [...]
17+
18+
# call through linuxdeploy
19+
> ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin demo --output appimage --icon-file mypackage.png --desktop-file mypackage.desktop
20+
```

demo/linuxdeploy-plugin-demo.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#! /bin/bash
2+
3+
# exit whenever a command called in this script fails
4+
set -e
5+
6+
appdir=""
7+
8+
show_usage() {
9+
echo "Usage: bash $0 --appdir <AppDir>"
10+
}
11+
12+
while [ "$1" != "" ]; do
13+
case "$1" in
14+
--plugin-api-version)
15+
echo "0"
16+
exit 0
17+
;;
18+
--appdir)
19+
appdir="$2"
20+
shift
21+
shift
22+
;;
23+
*)
24+
echo "Invalid argument: $1"
25+
echo
26+
show_usage
27+
exit 2
28+
esac
29+
done
30+
31+
if [[ "$appdir" == "" ]]; then
32+
show_usage
33+
exit 2
34+
fi
35+
36+
echo "Hello, this is linuxdeploy-plugin-demo"
37+
echo "\$LINUXDEPLOY: \"$LINUXDEPLOY\""
38+
39+
# install a demo AppRun hook
40+
# usually, they're not supposed to print anything, but remain as silent as possible
41+
set -x
42+
mkdir -p "$appdir"/apprun-hooks
43+
cat > "$appdir"/apprun-hooks/linuxdeploy-plugin-demo.sh <<\EOF
44+
echo "Hello from linuxdeploy-plugin-demo"
45+
EOF

0 commit comments

Comments
 (0)