├── LICENSE ├── README.md ├── deb2appimage.desktop ├── deb2appimage.png ├── deb2appimage.sh ├── json ├── alacritty.json ├── ansiweather.json ├── bbtag-editor.json ├── deb2appimage.json ├── discord-canary-wrapper.json ├── discord-canary.json ├── discord-ptb.json ├── discord-stable.json ├── firefox.json ├── google-docs.json ├── google-play-music.json ├── halloween-doodle.json ├── imagewriter.json ├── kitty.json ├── micro.json ├── neofetch.json ├── parsec.json ├── spm.json ├── troubleshooter.json ├── twitch-wrapper.json ├── vscode.json ├── yad.json ├── yadshot.json └── yata.json ├── resources ├── AppRun ├── desktopintegration └── fltk-dialog └── scripts ├── code.sh ├── discord-canary.sh ├── discord-ptb.sh ├── discord-stable.sh └── imagewriter.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 simonizor 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deb2appimage 2 | 3 | deb2appimage uses deb packages from Debian's and/or Ubuntu's repos to build AppImages based on simple JSON configuration. The debs are downloaded using `curl` and extracted using `ar x` so that AppImages can be built from any distribution. The JSON configuration files are setup in a way that they should be easy to understand, yet flexible enough to work with AppImages that require extra tweaking before building. `~/.cache/deb2appimage` is used as a temporary directory for building AppImages, and is deleted after run. 4 | 5 | Contrary to the name, deb2appimage may also be used with other package types as the source for the application (or even the deps), but these files must be downloaded and placed manually in a prerun script. 6 | 7 | It will help to make yourself familiar with [Debian's package website](https://www.debian.org/distrib/packages) and [Ubuntu's package website](https://packages.ubuntu.com) for getting the names of dependencies, which architecture they are for, and which version of Debian/Ubuntu we should grab them from. 8 | 9 | Dependencies: curl, tar, jq, binutils (jq and binutils are included in [deb2appimage's AppImage](https://github.com/simoniz0r/deb2appimage/releases)) 10 | # Arguments 11 | 12 | ``` 13 | --help|-h Show this output and exit 14 | 15 | --json|-j Specify the location of the json file for building the AppImage (required) 16 | 17 | --output|-o Specify the output directory of the AppImage (optional; $HOME will be used by default) 18 | 19 | --quiet|-q Enable quiet mode 20 | 21 | --debug Enable debug mode 22 | 23 | ``` 24 | 25 | Any arguments not listed above will be passed to 'appimagetool' when building the AppImage. 26 | 27 | Examples: 28 | 29 | ``` 30 | deb2appimage -j $HOME/my-app.json 31 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages 32 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages -q 33 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages --debug 34 | ``` 35 | # Setting up the JSON configuration 36 | 37 | Example JSON configuration for creating an AppImage of `parsec`: 38 | 39 | ``` 40 | { 41 | "buildinfo": [ 42 | { 43 | "prerun": [ 44 | "curl -sL https://s3.amazonaws.com/parsec-build/package/parsec-linux.deb -o ~/.cache/deb2appimage/debs/parsec-linux.deb" 45 | ], 46 | "name": "parsec", 47 | "version": "linux", 48 | "deps": "libsndio6.1,expat,libexpat1", 49 | "repoarch": "amd64", 50 | "distrorepo": "Debian", 51 | "repoversion": "jessie-backports,jessie,jessie", 52 | "binarypath": "/usr/bin/parsec", 53 | "desktoppath": "/usr/share/applications/parsec.desktop", 54 | "iconpath": "/usr/share/icons/hicolor/256x256/apps/parsec.png", 55 | "usewrapper": "true", 56 | "postrun": [ 57 | null 58 | ] 59 | } 60 | ], 61 | "apprunconf": [ 62 | { 63 | "setpath": "true", 64 | "setlibpath": "true", 65 | "setpythonpath": "false", 66 | "setpythonhome": "false", 67 | "setpythondontwritebytecode": "false", 68 | "setxdgdatadirs": "false", 69 | "setperllib": "false", 70 | "setgsettingsschemadir": "false", 71 | "setqtpluginpath": "false", 72 | "exec": "/usr/bin/parsec.wrapper" 73 | } 74 | ], 75 | "authors": [ 76 | { 77 | "type": "Author", 78 | "author": "parsecgaming", 79 | "url": "https://parsecgaming.com" 80 | }, 81 | { 82 | "type": "AppImage Maintainer", 83 | "author": "E5ten", 84 | "url": "https://github.com/E5ten" 85 | } 86 | ] 87 | } 88 | ``` 89 | 90 | ## buildinfo 91 | 92 | **prerun:** 93 | 94 | ``` 95 | "prerun": [ 96 | "curl -sL https://s3.amazonaws.com/parsec-build/package/parsec-linux.deb -o ~/.cache/deb2appimage/debs/parsec-linux.deb" 97 | ], 98 | ``` 99 | 100 | Here we download the deb package for parsec using `curl`. Multiple commands may be used, but complex commands may fail and can to be put in bash script. If a package for the target application is available in Debian's or Ubuntu's repos and no extra preperation is needed, simply put `null` as the prerun. 101 | 102 | **name:** 103 | 104 | ``` 105 | "name": "parsec", 106 | ``` 107 | 108 | Pretty self explanatory; just put the name of the application here. 109 | 110 | **version:** 111 | 112 | ``` 113 | "version": "linux", 114 | ``` 115 | 116 | The version of the application. If no version or `null` is entered, the current date will be used instead. 117 | 118 | **deps:** 119 | 120 | ``` 121 | "deps": "libsndio6.1,expat,libexpat1", 122 | ``` 123 | 124 | Dependencies as named on [Debian's package website](https://www.debian.org/distrib/packages) or [Ubuntu's package website](https://packages.ubuntu.com). Packages must be separated by commas (`package1,package2,package3,package4`). If a package for the target application is available in Debian's or Ubuntu's repos, you can list the target applicaton's package name here to have it be downloaded and placed in the AppImage automatically. 125 | 126 | **repoarch:** 127 | 128 | ``` 129 | "repoarch": "amd64", 130 | ``` 131 | 132 | This specifies the architecture of the dependencies in Debian's repo. Some packages may be `amd64` and some may be `all`. If ***all*** of the listed dependencies are ***not*** from the same architecture, then the `repoarch` must be specified for each package in a comma separated list. Ex: 133 | 134 | ``` 135 | "repoarch": "amd64,all,amd64", 136 | ``` 137 | 138 | **distrorepo:** 139 | 140 | ``` 141 | "distrorepo": "Debian", 142 | ``` 143 | 144 | This specifies which distribution to get packages from. Either Debian or Ubuntu may be used. 145 | 146 | **repoversion:** 147 | 148 | ``` 149 | "repoversion": "jessie-backports,jessie,jessie", 150 | ``` 151 | 152 | This specifies which version of the specified distribution we will be downloading packages from. We always want to *try* to use the oldest supported version that we can so that AppImages will work on as many distributions as possible. As with the `repoarch`, if all packages listed as dependencies do ***not*** come from the same version of the specified distribution, then the version must be specified for each package in a comma separated list. 153 | 154 | **binarypath:** 155 | 156 | ``` 157 | "binarypath": "/usr/bin/parsec", 158 | ``` 159 | 160 | The path to the binary file of the application after being extracted from the deb package. To find this, you can extract the deb file manually and look inside of `data.tar.gz`. For most deb packages, this is usually `/usr/bin/packagename`. 161 | 162 | **desktoppath:** 163 | 164 | ``` 165 | "desktoppath": "/usr/share/applications/parsec.desktop", 166 | ``` 167 | 168 | The path to the desktop file of the application after being extracted from the deb package. If a desktop file is not provided by the application, set this to `null` to have a generic desktop file created for use in the AppImage. 169 | 170 | **iconpath:** 171 | 172 | ``` 173 | "iconpath": "/usr/share/icons/hicolor/256x256/apps/parsec.png", 174 | ``` 175 | 176 | The path to the icon file of the application after being extracted fron the deb package. If no icon file is provided by the application, set this to `null` to have a generic icon downloaded for use in the AppImage. 177 | 178 | **usewrapper:** 179 | 180 | ``` 181 | "usewrapper": "true", 182 | ``` 183 | 184 | If this is set to true, the [desktopintegration](https://github.com/simoniz0r/deb2appimage/blob/master/resources/desktopintegration) script will be downloaded and placed in the `binarypath`. This script povides prompts to ask users if they would like to add the AppImage to their menu for easy access and also provides ways to remove those entries. 185 | 186 | If `/usr/bin/myapp` is the `binarypath`, then the `desktopintegration` script will be placed at `/usr/bin/myapp.wrapper` . If used, the `exec` line in the `apprunconf` section must be set to launch the wrapper script otherwise the application will just launch normally. 187 | 188 | **postrun:** 189 | 190 | ``` 191 | "postrun": [ 192 | null 193 | ] 194 | ``` 195 | 196 | The postrun command will be ran after all of the debs have been extracted and placed, and also after `~/.cache/deb2appimage/AppDir` has been prepared. This can be used to make any necessary changes to those files. As with `prerun`, multiple commands may be used, and a bash script can be used to for complex commands. If no `postrun` is needed, put `null` as the `postrun`. 197 | 198 | ## apprunconf 199 | 200 | This section is used to provide more flexability to `AppRun`; not every application needs all of these variables to be set (and some even don't work well with some of them set), so set them to true as needed. 201 | 202 | **setlibpath:** 203 | 204 | ``` 205 | "setpath": "true", 206 | ``` 207 | 208 | Adds `/usr/bin` within the AppImage to the user's `PATH`. This should pretty much always be set to `true` . 209 | 210 | **setlibpath:** 211 | 212 | ``` 213 | "setlibpath": "true", 214 | ``` 215 | 216 | Adds library paths within the AppImage to `LD_LIBRARY_PATH`. Most AppImages will more than likely need this set to `true` . 217 | 218 | **setpythonpath:** 219 | 220 | ``` 221 | "setpythonpath": "false", 222 | ``` 223 | 224 | Sets the `PYTHONPATH`. This should only be used if you are bundling Python in the AppImage. 225 | 226 | **setpythonhome:** 227 | 228 | ``` 229 | "setpythonhome": "false", 230 | ``` 231 | 232 | Sets the `PYTHONHOME`. This should also only be used if you are bundling Python in the AppImage. 233 | 234 | **setpythondontwritebytecode:** 235 | 236 | ``` 237 | "setpythondontwritebytecode": "false", 238 | ``` 239 | 240 | Sets `PYTHONDONTWRITEBYTECODE=1` for problems with some AppImages that use Python. Do not set this unless needed. 241 | 242 | **setxdgdatadirs:** 243 | 244 | ``` 245 | "setxdgdatadirs": "false", 246 | ``` 247 | 248 | Adds `/usr/share` within the AppImage to the `XDG_DATA_DIRS` . 249 | 250 | **setperllib:** 251 | 252 | ``` 253 | "setperllib": "false", 254 | ``` 255 | 256 | Adds `/usr/share/perl5` within the AppImage to the `PERLLIB` . 257 | 258 | **setgsettingsschemadir:** 259 | 260 | ``` 261 | "setgsettingsschemadir": "false", 262 | ``` 263 | 264 | Adds `/usr/share/glib-2.0/schemas` within the AppImage to the `GSETTINGS_SCHEMA_DIR` . 265 | 266 | **setqtpluginpath:** 267 | 268 | ``` 269 | "setqtpluginpath": "false", 270 | ``` 271 | 272 | Adds Qt paths within the AppImage to the `QT_PLUGIN_PATH` . 273 | 274 | **exec:** 275 | 276 | ``` 277 | "exec": "/usr/bin/parsec.wrapper" 278 | ``` 279 | 280 | This is ***required***. In most cases, it will be the same as the `binarypath`. If `usewrapper` is set to `true`, then the path to the wrapper should be inserted here. If a special script is needed to make the application launch properly, that script may be placed somewhere in `~/.cache/deb2appimage/AppDir` with a `prerun` or `postrun` command/script and then used as the `exec`. 281 | -------------------------------------------------------------------------------- /deb2appimage.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=deb2appimage 4 | GenericName=deb2appimage 5 | Comment=Build AppImages from deb packages on any distro with simple json configuration 6 | Exec=deb2appimage 7 | Categories=Utility; 8 | Icon=deb2appimage 9 | StartupNotify=false 10 | Terminal=true 11 | -------------------------------------------------------------------------------- /deb2appimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoniz0r/deb2appimage/cb1b333c00d424dab801b80404a4b3594fb466c1/deb2appimage.png -------------------------------------------------------------------------------- /deb2appimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Title: deb2appimage 3 | # Author: simonizor 4 | # License: MIT 5 | # Description: Build AppImages from deb packages on any distro with simple json configuration 6 | # Dependencies: jq, curl, ar, tar 7 | 8 | # function to handle exits 9 | function d2aexit() { 10 | case $1 in 11 | # normal exit; remove "$HOME"/.cache/deb2appimage before exiting 12 | 0) 13 | rm -rf "$HOME"/.cache/deb2appimage/* 14 | exit 0 15 | ;; 16 | # missing dependencies 17 | 1) 18 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 19 | echo "Dependency Error!" 20 | echo "Missing: $2" 21 | if [[ -n "$3" ]]; then 22 | echo "$3" 23 | fi 24 | echo "Exit code 1" 25 | fi 26 | rm -rf "$HOME"/.cache/deb2appimage/* 27 | exit 1 28 | ;; 29 | # user input error 30 | 2) 31 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 32 | echo "Input Error!" 33 | echo "$2" 34 | if [[ -n "$3" ]]; then 35 | echo "$3" 36 | fi 37 | echo "Exit code 2" 38 | fi 39 | rm -rf "$HOME"/.cache/deb2appimage/* 40 | exit 2 41 | ;; 42 | # curl error 43 | 3) 44 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 45 | echo "Download Error!" 46 | echo "Error while downloading $2" 47 | if [[ -n "$3" ]]; then 48 | echo "$3" 49 | fi 50 | echo "Exit code 3" 51 | fi 52 | rm -rf "$HOME"/.cache/deb2appimage/* 53 | exit 3 54 | ;; 55 | # file/dir error 56 | 4) 57 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 58 | echo "Directory/File Error!" 59 | echo "Error while creating file/directory $2" 60 | if [[ -n "$3" ]]; then 61 | echo "$3" 62 | fi 63 | echo "Exit code 4" 64 | fi 65 | rm -rf "$HOME"/.cache/deb2appimage/* 66 | exit 4 67 | ;; 68 | # deb extraction error 69 | 5) 70 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 71 | echo "Error Extracting Deb!" 72 | echo "Error while extracting $2" 73 | if [[ -n "$3" ]]; then 74 | echo "$3" 75 | fi 76 | echo "Exit code 5" 77 | fi 78 | rm -rf "$HOME"/.cache/deb2appimage/* 79 | exit 5 80 | ;; 81 | # appimagetool error 82 | 6) 83 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 84 | echo "Error Running appimagetool!" 85 | echo "appimagetool failed to build $2" 86 | if [[ -n "$3" ]]; then 87 | echo "$3" 88 | fi 89 | echo "Exit code 6" 90 | fi 91 | rm -rf "$HOME"/.cache/deb2appimage/* 92 | exit 6 93 | ;; 94 | esac 95 | } 96 | 97 | function d2aprerun() { 98 | if [[ -d "$HOME/.cache/deb2appimage/AppDir" ]]; then 99 | d2aexit 4 "$HOME/.cache/deb2appimage/AppDir" "Directory exists!" 100 | fi 101 | mkdir -p "$HOME"/.cache/deb2appimage/AppDir 102 | mkdir -p "$HOME"/.cache/deb2appimage/debs 103 | mkdir -p "$HOME"/.cache/deb2appimage/other 104 | cp "$D2A_JSON" "$HOME"/.cache/deb2appimage/build.json 105 | } 106 | 107 | # execute prerun command if not null 108 | function preruncmd() { 109 | PRERUN_CMD="$(jq -r '.buildinfo[0].prerun[]' "$HOME"/.cache/deb2appimage/build.json | sed "s,^.*,& \&\& ,g" | tr -d '\n' | rev | cut -f3- -d' ' | rev)" 110 | if [[ ! "$PRERUN_CMD" = "null" ]]; then 111 | bash -c "$PRERUN_CMD" || d2aexit 2 "'prerun' failed!" "Failed to execute: $PRERUN_CMD" 112 | fi 113 | } 114 | 115 | # function to find latest debs based on user input 116 | function getlatestdeb() { 117 | DEB_NAME="$1" 118 | DEB_DISTRO="$2" 119 | DEB_RELEASE="$3" 120 | DEB_ARCH="$4" 121 | case $DEB_DISTRO in 122 | Debian|debian) 123 | DEB_DISTRO_URL="debian.org" 124 | ;; 125 | Ubuntu|ubuntu) 126 | DEB_DISTRO_URL="ubuntu.com" 127 | ;; 128 | *) 129 | d2aexit 2 "Invalid 'distrorepo' entered in json file" "Valid choices are Debian and Ubuntu" 130 | ;; 131 | esac 132 | # find latest deb url using grep and head -n 1 133 | LATEST_DEB_URL="$(curl -sL "https://packages.$DEB_DISTRO_URL/$DEB_RELEASE/$DEB_ARCH/$DEB_NAME/download" | grep "
  • *..*$DEB_ARCH.deb" | cut -f2 -d'"' | head -n 1)" 134 | curl -sL "$LATEST_DEB_URL" -o "$HOME"/.cache/deb2appimage/debs/"$DEB_NAME".deb || d2aexit 3 "$DEB_NAME.deb" "URL: $LATEST_DEB_URL" 135 | } 136 | 137 | # function that uses jq to get package's deps from build.json 138 | function getappdeps() { 139 | if [[ ! "$(jq -r '.buildinfo[0].deps' "$HOME"/.cache/deb2appimage/build.json)" = "null" ]]; then 140 | COUNT_NUM=1 141 | # run a for loop to download the latest version of each deb using getlatestdeb function 142 | for appdep in $(jq -r '.buildinfo[0].deps' "$HOME"/.cache/deb2appimage/build.json | tr ',' '\n'); do 143 | DEB_REPO_DISTRO="$(jq -r '.buildinfo[0].distrorepo' "$HOME"/.cache/deb2appimage/build.json | cut -f${COUNT_NUM} -d',')" 144 | DEB_REPO_VERSION="$(jq -r '.buildinfo[0].repoversion' "$HOME"/.cache/deb2appimage/build.json | cut -f${COUNT_NUM} -d',')" 145 | DEB_REPO_ARCH="$(jq -r '.buildinfo[0].repoarch' "$HOME"/.cache/deb2appimage/build.json | cut -f${COUNT_NUM} -d',')" 146 | if [[ -z "$DEB_REPO_DISTRO" ]]; then 147 | DEB_REPO_DISTRO="$DEB_LAST_DISTRO" 148 | fi 149 | if [[ -z "$DEB_REPO_ARCH" ]]; then 150 | DEB_REPO_ARCH="$DEB_LAST_ARCH" 151 | fi 152 | if [[ -z "$DEB_REPO_VERSION" ]]; then 153 | DEB_REPO_VERSION="$DEB_LAST_VERSION" 154 | fi 155 | getlatestdeb "$appdep" "$DEB_REPO_DISTRO" "$DEB_REPO_VERSION" "$DEB_REPO_ARCH" 156 | COUNT_NUM=$(($COUNT_NUM+1)) 157 | DEB_LAST_DISTRO="$DEB_REPO_DISTRO" 158 | DEB_LAST_ARCH="$DEB_REPO_ARCH" 159 | DEB_LAST_VERSION="$DEB_REPO_VERSION" 160 | done 161 | fi 162 | } 163 | 164 | # function to extract debs and move them to AppDir folder 165 | function debextract () { 166 | mkdir -p "$HOME"/.cache/deb2appimage/debs/temp 167 | cd "$HOME"/.cache/deb2appimage/debs/temp 168 | mv "$HOME"/.cache/deb2appimage/debs/"$1" "$HOME"/.cache/deb2appimage/debs/temp/"$1" 169 | ar x "$HOME"/.cache/deb2appimage/debs/temp/"$1" 170 | rm -f "$HOME"/.cache/deb2appimage/debs/temp/"$1" 171 | rm -f "$HOME"/.cache/deb2appimage/debs/temp/control.tar.gz 172 | rm -f "$HOME"/.cache/deb2appimage/debs/temp/debian-binary 173 | tar -xf "$HOME"/.cache/deb2appimage/debs/temp/data.tar.* -C "$HOME"/.cache/deb2appimage/debs/temp/ 174 | rm -f "$HOME"/.cache/deb2appimage/debs/temp/data.tar.* 175 | chmod -R 755 ~/.cache/deb2appimage 176 | cp -r "$HOME"/.cache/deb2appimage/debs/temp/* "$HOME"/.cache/deb2appimage/AppDir/ 177 | rm -rf "$HOME"/.cache/deb2appimage/*/debs/temp/* 178 | } 179 | 180 | # function that runs a for loop to find all downloaded debs and extract them 181 | function finddownloadeddebs() { 182 | for debpkg in $(ls -C -w 1 "$HOME"/.cache/deb2appimage/debs); do 183 | debextract "$debpkg" || d2aexit 5 "$debpkg" 184 | done 185 | rm -rf "$HOME"/.cache/deb2appimage/*/debs 186 | } 187 | 188 | # function that places files in places where appimagetool expects them to be for building AppImage 189 | function prepareappdir() { 190 | APP_NAME="$(jq -r '.buildinfo[0].name' "$HOME"/.cache/deb2appimage/build.json)" 191 | BINARY_PATH="$(jq -r '.buildinfo[0].binarypath' "$HOME"/.cache/deb2appimage/build.json)" 192 | DESKTOP_PATH="$(jq -r '.buildinfo[0].desktoppath' "$HOME"/.cache/deb2appimage/build.json)" 193 | ICON_PATH="$(jq -r '.buildinfo[0].iconpath' "$HOME"/.cache/deb2appimage/build.json)" 194 | USE_WRAPPER="$(jq -r '.buildinfo[0].usewrapper' "$HOME"/.cache/deb2appimage/build.json)" 195 | if [[ "$APP_NAME" = "null" ]]; then 196 | d2aexit 2 "Missing required 'appname' in json file" 197 | fi 198 | if [[ ! -f "$HOME/.cache/deb2appimage/AppDir$BINARY_PATH" ]]; then 199 | d2aexit 2 "Binary file not found at binarypath in json file" 200 | fi 201 | # Download icon if it does not exist 202 | if [[ ! -f "$HOME/.cache/deb2appimage/AppDir$ICON_PATH" ]]; then 203 | echo "$ICON_PATH not found; downloading generic icon..." 204 | curl -sL "https://raw.githubusercontent.com/iconic/open-iconic/master/png/file-6x.png" -o "$HOME"/.cache/deb2appimage/AppDir/."$APP_NAME".png 205 | ICON_PATH="/.$APP_NAME.png" 206 | fi 207 | # Create .desktop file if it does not exist 208 | if [[ ! -f "$HOME/.cache/deb2appimage/AppDir$DESKTOP_PATH" ]]; then 209 | echo "$DESKTOP_PATH not found; creating generic .desktop file..." 210 | cat > "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop << EOL 211 | [Desktop Entry] 212 | Type=Application 213 | Name=$APP_NAME 214 | Comment=$APP_NAME 215 | Exec=$BINARY_PATH 216 | Categories=Utility; 217 | Icon=$APP_NAME 218 | StartupNotify=false 219 | Terminal=false 220 | 221 | EOL 222 | else 223 | cp "$HOME"/.cache/deb2appimage/AppDir"$DESKTOP_PATH" "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop 224 | DESKTOP_CATEGORIES="$(grep '^Categories=' "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop)" 225 | if [[ -z "$DESKTOP_CATEGORIES" ]]; then 226 | echo "Categories=Utility;" >> "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop 227 | elif [[ ! "$(echo $DESKTOP_CATEGORIES | rev | cut -c1)" = ";" ]]; then 228 | sed -i 's%^Categories=.*%Categories=Utility;%g' "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop 229 | fi 230 | fi 231 | if [[ "$USE_WRAPPER" = "true" ]]; then 232 | curl -sSL "https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/resources/desktopintegration" -o "$HOME"/.cache/deb2appimage/AppDir"$BINARY_PATH".wrapper || d2aexit 3 "wrapper script" 233 | curl -sSL "https://github.com/darealshinji/AppImageKit-dialog/releases/download/continuous/dialog-x86_64" -o "$HOME"/.cache/deb2appimage/AppDir/dialog || d2aexit 3 "wrapper script" 234 | chmod a+x "$HOME"/.cache/deb2appimage/AppDir/dialog 235 | chmod a+x "$HOME"/.cache/deb2appimage/AppDir"$BINARY_PATH".wrapper 236 | fi 237 | ICON_TYPE="$(echo $ICON_PATH | rev | cut -f1 -d'.' | rev)" 238 | ICON_SIZE=$(file "$HOME"/.cache/deb2appimage/AppDir${ICON_PATH} | cut -f2 -d',' | tr -d '[:blank:]' | cut -f1 -d'x') 239 | mkdir -p "$HOME"/.cache/deb2appimage/AppDir/usr/share/icons/default/${ICON_SIZE}x${ICON_SIZE}/apps 240 | cp "$HOME"/.cache/deb2appimage/AppDir"$ICON_PATH" "$HOME"/.cache/deb2appimage/AppDir/usr/share/icons/default/${ICON_SIZE}x${ICON_SIZE}/apps/"$APP_NAME"."$ICON_TYPE" 241 | cp "$HOME"/.cache/deb2appimage/AppDir"$ICON_PATH" "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME"."$ICON_TYPE" 242 | sed -i "s,^Exec=.*,Exec=.$BINARY_PATH,g;s,^Icon=.*,Icon=$APP_NAME,g" "$HOME"/.cache/deb2appimage/AppDir/"$APP_NAME".desktop 243 | } 244 | 245 | # function that downloads AppRun and creates AppRun.conf 246 | function prepareapprun() { 247 | curl -sL "https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/resources/AppRun" -o "$HOME"/.cache/deb2appimage/AppDir/AppRun || d2aexit 3 "AppRun script" 248 | chmod a+x "$HOME"/.cache/deb2appimage/AppDir/AppRun 249 | APPRUN_SET_PATH="$(jq -r '.apprunconf[0].setpath' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 250 | APPRUN_SET_LIBPATH="$(jq -r '.apprunconf[0].setlibpath' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 251 | APPRUN_SET_PYTHONPATH="$(jq -r '.apprunconf[0].setpythonpath' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 252 | APPRUN_SET_PYTHONHOME="$(jq -r '.apprunconf[0].setpythonhome' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 253 | APPRUN_SET_PYTHONBYTE="$(jq -r '.apprunconf[0].setpythondontwritebytecode' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 254 | APPRUN_SET_XDG="$(jq -r '.apprunconf[0].setxdgdatadirs' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 255 | APPRUN_SET_PERL="$(jq -r '.apprunconf[0].setperllib' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 256 | APPRUN_SET_QT="$(jq -r '.apprunconf[0].setqtpluginpath' "$HOME"/.cache/deb2appimage/build.json | tr '[:lower:]' '[:upper:]')" 257 | APPRUN_EXEC="$(jq -r '.apprunconf[0].exec' "$HOME"/.cache/deb2appimage/build.json)" 258 | cat >"$HOME"/.cache/deb2appimage/AppDir/AppRun.conf << EOL 259 | APPRUN_SET_PATH="$APPRUN_SET_PATH" 260 | APPRUN_SET_LD_LIBRARY_PATH="$APPRUN_SET_LIBPATH" 261 | APPRUN_SET_PYTHONPATH="$APPRUN_SET_PYTHONPATH" 262 | APPRUN_SET_PYTHONHOME="$APPRUN_SET_PYTHONHOME" 263 | APPRUN_SET_PYTHONDONTWRITEBYTECODE="$APPRUN_SET_PYTHONBYTE" 264 | APPRUN_SET_XDG_DATA_DIRS="$APPRUN_SET_XDG" 265 | APPRUN_SET_PERLLIB="$APPRUN_SET_PERL" 266 | APPRUN_SET_GSETTINGS_SCHEMA_DIR="$APPRUN_SET_GSETTINGS" 267 | APPRUN_SET_QT_PLUGIN_PATH="$APPRUN_SET_QT" 268 | APPRUN_EXEC="$APPRUN_EXEC" 269 | 270 | EOL 271 | } 272 | 273 | # function that runs postruncmd 274 | function postruncmd() { 275 | POSTRUN_CMD="$(jq -r '.buildinfo[0].postrun[]' "$HOME"/.cache/deb2appimage/build.json | sed "s,^.*,& \&\& ,g" | tr -d '\n' | rev | cut -f3- -d' ' | rev)" 276 | if [[ ! "$POSTRUN_CMD" = "null" ]]; then 277 | bash -c "$POSTRUN_CMD" || d2aexit 2 "'postrun' failed!" "Failed to execute: $POSTRUN_CMD" 278 | fi 279 | } 280 | 281 | # function that downloads appimagetool and uses it to build the AppImage to the --output directory 282 | function buildappimage() { 283 | APP_VERSION="$(jq -r '.buildinfo[0].version' "$HOME"/.cache/deb2appimage/build.json)" 284 | if [[ -z "$APP_VERSION" ]] || [[ "$APP_VERSION" = "null" ]]; then 285 | APP_VERSION="$(date +'%F')" 286 | fi 287 | curl -sL "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -o "$HOME"/.cache/deb2appimage/appimagetool || d2aexit 3 "appimagetool" 288 | chmod +x "$HOME"/.cache/deb2appimage/appimagetool 289 | if [[ "$D2A_QUIET" = "TRUE" ]]; then 290 | ARCH="$(uname -m)" "$HOME"/.cache/deb2appimage/appimagetool "$@" "$HOME"/.cache/deb2appimage/AppDir "$D2A_OUTPUT"/"$APP_NAME"-"$APP_VERSION"-"$(uname -m)".AppImage > /dev/null 2>&1 || d2aexit 6 "$APP_NAME" 291 | else 292 | ARCH="$(uname -m)" "$HOME"/.cache/deb2appimage/appimagetool "$@" "$HOME"/.cache/deb2appimage/AppDir "$D2A_OUTPUT"/"$APP_NAME"-"$APP_VERSION"-"$(uname -m)".AppImage || d2aexit 6 "$APP_NAME" 293 | fi 294 | } 295 | 296 | function d2ahelp() { 297 | printf '%s\n' "deb2appimage 0.0.5 298 | Usage deb2appimage [argument] [input] 299 | 300 | deb2appimage is a tool for creating AppImages using deb packages. json files are used 301 | to provide simple configuration for building the AppImage. Contrary to the name, other 302 | package types can also be used as the source of the application (or even its deps), but 303 | those files will have to be placed in '~/.cache/deb2appimage/AppDir/' manually with a 304 | prerun script. 305 | 306 | Arguments: 307 | --help, -h Show this output and exit 308 | --json, -j Specify the location of the json file for building the AppImage (required) 309 | --output, -o Specify the output directory of the AppImage (optional; $HOME will be used by default) 310 | --quiet, -q Enable quiet mode 311 | --debug Enable debug mode 312 | 313 | Any arguments not listed above will be passed to 'appimagetool' when building the AppImage. 314 | 315 | Examples: 316 | deb2appimage -j $HOME/my-app.json 317 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages 318 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages -q 319 | deb2appimage -j $HOME/my-app.json -o $HOME/AppImages --debug 320 | " 321 | } 322 | 323 | # detect arguments 324 | while [[ $# -gt 0 ]]; do 325 | case "$1" in 326 | # output help 327 | -h|--help) 328 | d2ahelp 329 | d2aexit 0 330 | ;; 331 | # set path to json file (required) 332 | -j|--json) 333 | shift 334 | D2A_JSON="$(readlink -f $1)" 335 | shift 336 | ;; 337 | # set output directory (optional) 338 | -o|--output) 339 | shift 340 | D2A_OUTPUT="$(readlink -f $1)" 341 | shift 342 | ;; 343 | # turn on quiet mode 344 | -q|--quiet) 345 | D2A_QUIET="TRUE" 346 | shift 347 | ;; 348 | # turn on debug mode 349 | --debug) 350 | set -x 351 | shift 352 | ;; 353 | esac 354 | done 355 | 356 | # check for deb2appimage's dependencies and exit if not installed 357 | mkdir -p "$HOME"/.cache/deb2appimage 358 | unset MISSING_DEPS 359 | if [[ ! "$(command -v jq)" ]]; then 360 | MISSING_DEPS+=("jq") 361 | fi 362 | if [[ ! "$(command -v curl)" ]]; then 363 | MISSING_DEPS+=("curl") 364 | fi 365 | if [[ ! "$(command -v ar)" ]]; then 366 | MISSING_DEPS+=("binutils") 367 | fi 368 | if [[ ! "$(command -v tar)" ]]; then 369 | MISSING_DEPS+=("tar") 370 | fi 371 | if [[ ! -z "$MISSING_DEPS" ]]; then 372 | d2aexit 1 "$(echo ${MISSING_DEPS[@]})" 373 | fi 374 | 375 | # check required inputs 376 | if [[ -z "$D2A_JSON" ]]; then 377 | d2ahelp 378 | d2aexit 2 "Missing required --json input" 379 | fi 380 | # make sure json input is valid 381 | jq '.' "$D2A_JSON" > /dev/null 2>&1 || d2aexit 2 "$D2A_JSON not valid json file" 382 | # set default output location 383 | if [[ -z "$D2A_OUTPUT" ]]; then 384 | D2A_OUTPUT="$HOME" 385 | fi 386 | 387 | d2aprerun 388 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 389 | echo "Executing prerun..." 390 | fi 391 | preruncmd 392 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 393 | echo "Downloading dependencies..." 394 | fi 395 | getappdeps 396 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 397 | echo "Extracting dependencies..." 398 | fi 399 | finddownloadeddebs 400 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 401 | echo "Preparing AppImage AppDir..." 402 | fi 403 | prepareappdir 404 | prepareapprun 405 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 406 | echo "Executing postrun..." 407 | fi 408 | postruncmd 409 | if [[ ! "$D2A_QUIET" = "TRUE" ]]; then 410 | echo "Using 'appimagetool' to build AppImage for '$APP_NAME' to '$D2A_OUTPUT'..." 411 | fi 412 | buildappimage && d2aexit 0 413 | -------------------------------------------------------------------------------- /json/alacritty.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "curl -sSL -o ~/.cache/deb2appimage/debs/alacritty.deb 'https://github.com/jwilm/alacritty/releases/download/v0.2.4/Alacritty-v0.2.4_amd64.deb'" 6 | ], 7 | "name": "alacritty", 8 | "version": "0.2.4", 9 | "deps": "libexpat1,zlib1g,libpng16-16", 10 | "repoarch": "amd64", 11 | "distrorepo": "Debian", 12 | "repoversion": "stretch", 13 | "binarypath": "/usr/bin/alacritty", 14 | "desktoppath": "/usr/share/applications/alacritty.desktop", 15 | "iconpath": null, 16 | "usewrapper": "true", 17 | "postrun": [ 18 | null 19 | ] 20 | } 21 | ], 22 | "apprunconf": [ 23 | { 24 | "setpath": "true", 25 | "setlibpath": "true", 26 | "setpythonpath": "false", 27 | "setpythonhome": "false", 28 | "setpythondontwritebytecode": "false", 29 | "setxdgdatadirs": "false", 30 | "setperllib": "false", 31 | "setgsettingsschemadir": "false", 32 | "setqtpluginpath": "false", 33 | "exec": "/usr/bin/alacritty.wrapper" 34 | } 35 | ], 36 | "authors": [ 37 | { 38 | "type": "Author", 39 | "author": "jwilm", 40 | "url": "https://github.com/jwilm/alacritty" 41 | }, 42 | { 43 | "type": "AppImage Maintainer", 44 | "author": "simonizor", 45 | "url": "http://www.simonizor.net" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /json/ansiweather.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | null 6 | ], 7 | "name": "ansiweather", 8 | "version": "1.11", 9 | "deps": "ansiweather,bc,libreadline6,libtinfo5,jq,libjq1,libonig2", 10 | "repoarch": "all,amd64,amd64,amd64,amd64,amd64,amd64", 11 | "distrorepo": "Debian", 12 | "repoversion": "buster,jessie,jessie,jessie,jessie-backports,jessie-backports,jessie", 13 | "binarypath": "/usr/bin/ansiweather", 14 | "desktoppath": null, 15 | "iconpath": null, 16 | "usewrapper": "false", 17 | "postrun": [ 18 | null 19 | ] 20 | } 21 | ], 22 | "apprunconf": [ 23 | { 24 | "setpath": "true", 25 | "setlibpath": "true", 26 | "setpythonpath": "false", 27 | "setpythonhome": "false", 28 | "setpythondontwritebytecode": "false", 29 | "setxdgdatadirs": "false", 30 | "setperllib": "false", 31 | "setgsettingsschemadir": "false", 32 | "setqtpluginpath": "false", 33 | "exec": "/usr/bin/ansiweather" 34 | } 35 | ], 36 | "authors": [ 37 | { 38 | "type": "Author", 39 | "author": "fcambus", 40 | "url": "https://github.com/fcambus/ansiweather" 41 | }, 42 | { 43 | "type": "AppImage Maintainer", 44 | "author": "simonizor", 45 | "url": "http://www.simonizor.net" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /json/bbtag-editor.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir", 6 | "cd ~/.cache/deb2appimage/AppDir", 7 | "export LATEST_STABLE_ELECTRON=\"$(curl -sL \"https://electronjs.org/releases/stable\" | grep -m1 '

    ~/.cache/deb2appimage/AppDir/usr/bin/discord-canary-version" 13 | ], 14 | "name": "discord-canary", 15 | "version": "latest", 16 | "deps": "libnotify4,libatomic1,libxss1,libxtst6,libappindicator1,libnspr4,libnss3,libgconf-2-4", 17 | "repoarch": "amd64", 18 | "distrorepo": "Debian", 19 | "repoversion": "jessie", 20 | "binarypath": "/usr/bin/discord-canary", 21 | "desktoppath": "/usr/share/discord-canary/discord-canary.desktop", 22 | "iconpath": "/usr/share/discord-canary/discord.png", 23 | "usewrapper": "true", 24 | "postrun": [ 25 | null 26 | ] 27 | } 28 | ], 29 | "apprunconf": [ 30 | { 31 | "setpath": "true", 32 | "setlibpath": "true", 33 | "setpythonpath": "false", 34 | "setpythonhome": "false", 35 | "setpythondontwritebytecode": "false", 36 | "setxdgdatadirs": "false", 37 | "setperllib": "false", 38 | "setgsettingsschemadir": "false", 39 | "setqtpluginpath": "false", 40 | "exec": "discord-canary.sh" 41 | } 42 | ], 43 | "authors": [ 44 | { 45 | "type": "Author", 46 | "author": "Discord", 47 | "url": "https://discordapp.com" 48 | }, 49 | { 50 | "type": "AppImage Maintainer", 51 | "author": "simonizor", 52 | "url": "http://www.simonizor.net/discord" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /json/discord-ptb.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir/usr/bin", 6 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/discord-ptb.sh 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/scripts/discord-ptb.sh'", 7 | "chmod a+x ~/.cache/deb2appimage/AppDir/usr/bin/discord-ptb.sh", 8 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/discord-ptb.json 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/json/discord-ptb.json'", 9 | "curl -sL -o ~/.cache/deb2appimage/debs/discord-ptb.deb 'https://discordapp.com/api/download/ptb?platform=linux&format=deb'", 10 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/deb2appimage 'https://github.com/simoniz0r/deb2appimage/releases/download/v0.0.5/deb2appimage-0.0.5-x86_64.AppImage'", 11 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/fltk-dialog 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/resources/fltk-dialog'", 12 | "curl -sSL -I -X GET 'https://discordapp.com/api/download/ptb?platform=linux&format=tar.gz' | grep -im1 '^location:' | rev | cut -f1 -d'-' | cut -f3- -d'.' | rev > ~/.cache/deb2appimage/AppDir/usr/bin/discord-ptb-version" 13 | ], 14 | "name": "discord-ptb", 15 | "version": "latest", 16 | "deps": "libnotify4,libatomic1,libxss1,libxtst6,libappindicator1,libnspr4,libnss3,libgconf-2-4", 17 | "repoarch": "amd64", 18 | "distrorepo": "Debian", 19 | "repoversion": "jessie", 20 | "binarypath": "/usr/bin/discord-ptb", 21 | "desktoppath": "/usr/share/discord-ptb/discord-ptb.desktop", 22 | "iconpath": "/usr/share/discord-ptb/discord.png", 23 | "usewrapper": "true", 24 | "postrun": [ 25 | null 26 | ] 27 | } 28 | ], 29 | "apprunconf": [ 30 | { 31 | "setpath": "true", 32 | "setlibpath": "true", 33 | "setpythonpath": "false", 34 | "setpythonhome": "false", 35 | "setpythondontwritebytecode": "false", 36 | "setxdgdatadirs": "false", 37 | "setperllib": "false", 38 | "setgsettingsschemadir": "false", 39 | "setqtpluginpath": "false", 40 | "exec": "discord-ptb.sh" 41 | } 42 | ], 43 | "authors": [ 44 | { 45 | "type": "Author", 46 | "author": "Discord", 47 | "url": "https://discordapp.com" 48 | }, 49 | { 50 | "type": "AppImage Maintainer", 51 | "author": "simonizor", 52 | "url": "http://www.simonizor.net/discord" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /json/discord-stable.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir/usr/bin", 6 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/discord-stable.sh 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/scripts/discord-stable.sh'", 7 | "chmod a+x ~/.cache/deb2appimage/AppDir/usr/bin/discord-stable.sh", 8 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/discord-stable.json 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/json/discord-stable.json'", 9 | "curl -sL -o ~/.cache/deb2appimage/debs/discord.deb 'https://discordapp.com/api/download?platform=linux&format=deb'", 10 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/deb2appimage 'https://github.com/simoniz0r/deb2appimage/releases/download/v0.0.5/deb2appimage-0.0.5-x86_64.AppImage'", 11 | "curl -sL -o ~/.cache/deb2appimage/AppDir/usr/bin/fltk-dialog 'https://raw.githubusercontent.com/simoniz0r/deb2appimage/master/resources/fltk-dialog'", 12 | "curl -sSL -I -X GET 'https://discordapp.com/api/download?platform=linux&format=tar.gz' | grep -im1 '^location:' | rev | cut -f1 -d'-' | cut -f3- -d'.' | rev > ~/.cache/deb2appimage/AppDir/usr/bin/discord-version" 13 | ], 14 | "name": "discord", 15 | "version": "latest", 16 | "deps": "libnotify4,libatomic1,libxss1,libxtst6,libappindicator1,libnspr4,libnss3,libgconf-2-4", 17 | "repoarch": "amd64", 18 | "distrorepo": "Debian", 19 | "repoversion": "jessie", 20 | "binarypath": "/usr/bin/discord", 21 | "desktoppath": "/usr/share/discord/discord.desktop", 22 | "iconpath": "/usr/share/discord/discord.png", 23 | "usewrapper": "true", 24 | "postrun": [ 25 | null 26 | ] 27 | } 28 | ], 29 | "apprunconf": [ 30 | { 31 | "setpath": "true", 32 | "setlibpath": "true", 33 | "setpythonpath": "false", 34 | "setpythonhome": "false", 35 | "setpythondontwritebytecode": "false", 36 | "setxdgdatadirs": "false", 37 | "setperllib": "false", 38 | "setgsettingsschemadir": "false", 39 | "setqtpluginpath": "false", 40 | "exec": "discord-stable.sh" 41 | } 42 | ], 43 | "authors": [ 44 | { 45 | "type": "Author", 46 | "author": "Discord", 47 | "url": "https://discordapp.com" 48 | }, 49 | { 50 | "type": "AppImage Maintainer", 51 | "author": "simonizor", 52 | "url": "http://www.simonizor.net/discord" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /json/firefox.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir/usr/lib", 6 | "curl -sSL -o ~/.cache/deb2appimage/firefox.tar.bz2 'https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US'", 7 | "tar xf ~/.cache/deb2appimage/firefox.tar.bz2 -C ~/.cache/deb2appimage/AppDir/usr/lib", 8 | "curl -sSL -o ~/.cache/deb2appimage/AppDir/usr/lib/firefox/firefox.desktop 'https://raw.githubusercontent.com/simoniz0r/spm/master/apps/firefox/firefox.desktop'" 9 | ], 10 | "name": "firefox", 11 | "version": "59", 12 | "deps": null, 13 | "repoarch": null, 14 | "distrorepo": null, 15 | "repoversion": null, 16 | "binarypath": "/usr/lib/firefox/firefox-bin", 17 | "desktoppath": "/usr/lib/firefox/firefox.desktop", 18 | "iconpath": "/usr/lib/firefox/browser/chrome/icons/default/default128.png", 19 | "usewrapper": "true", 20 | "postrun": [ 21 | null 22 | ] 23 | } 24 | ], 25 | "apprunconf": [ 26 | { 27 | "setpath": "true", 28 | "setlibpath": "true", 29 | "setpythonpath": "false", 30 | "setpythonhome": "false", 31 | "setpythondontwritebytecode": "false", 32 | "setxdgdatadirs": "false", 33 | "setperllib": "false", 34 | "setgsettingsschemadir": "false", 35 | "setqtpluginpath": "false", 36 | "exec": "/usr/lib/firefox/firefox-bin.wrapper" 37 | } 38 | ], 39 | "authors": [ 40 | { 41 | "type": "Author", 42 | "author": "Mozilla", 43 | "url": "https://mozilla.org" 44 | }, 45 | { 46 | "type": "AppImage Maintainer", 47 | "author": "simonizor", 48 | "url": "http://www.simonizor.net" 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /json/google-docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir", 6 | "cd ~/.cache/deb2appimage/AppDir", 7 | "export LATEST_STABLE_ELECTRON=\"$(curl -sL \"https://electronjs.org/releases/stable\" | grep -m1 '

    ~/.cache/deb2appimage/AppDir/usr/share/code/.version", 13 | "curl -sSL -o ~/.cache/deb2appimage/debs/vscode.deb 'https://update.code.visualstudio.com/latest/linux-deb-x64/stable'" 14 | ], 15 | "name": "vscode", 16 | "version": "latest", 17 | "deps": "libnss3,libxkbfile1,libgconf-2-4,libnotify4", 18 | "repoarch": "amd64", 19 | "distrorepo": "Debian", 20 | "repoversion": "stretch", 21 | "binarypath": "/usr/share/code/code.sh", 22 | "desktoppath": "/usr/share/applications/code.desktop", 23 | "iconpath": "/usr/share/code/resources/app/resources/linux/code.png", 24 | "usewrapper": "true", 25 | "postrun": [ 26 | null 27 | ] 28 | } 29 | ], 30 | "apprunconf": [ 31 | { 32 | "setpath": "true", 33 | "setlibpath": "true", 34 | "setpythonpath": "false", 35 | "setpythonhome": "false", 36 | "setpythondontwritebytecode": "false", 37 | "setxdgdatadirs": "false", 38 | "setperllib": "false", 39 | "setgsettingsschemadir": "false", 40 | "setqtpluginpath": "false", 41 | "exec": "/usr/share/code/code.sh.wrapper" 42 | } 43 | ], 44 | "authors": [ 45 | { 46 | "type": "Author", 47 | "author": "Microsoft", 48 | "url": "https://code.visualstudio.com/" 49 | }, 50 | { 51 | "type": "AppImage Maintainer", 52 | "author": "simonizor", 53 | "url": "http://www.simonizor.net" 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /json/yad.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "curl -sSL -o ~/.cache/deb2appimage/debs/yad.deb 'https://launchpad.net/~webupd8team/+archive/ubuntu/y-ppa-manager/+files/yad_0.39.0-1~webupd8~trusty0_amd64.deb'" 6 | ], 7 | "name": "yad", 8 | "version": "0.39", 9 | "deps": "libcairo2,libpango-1.0-0,libpangocairo-1.0-0,libsoup2.4-1,libwebkitgtk-3.0-0,libpng12-0,libjavascriptcoregtk-3.0-0,libgeoclue0,libicu52,libwebp5,libpangoft2-1.0-0", 10 | "repoarch": "amd64", 11 | "distrorepo": "Ubuntu", 12 | "repoversion": "trusty", 13 | "binarypath": "/usr/bin/yad", 14 | "desktoppath": null, 15 | "iconpath": "/usr/share/icons/hicolor/128x128/apps/yad.png", 16 | "usewrapper": "false", 17 | "postrun": [ 18 | null 19 | ] 20 | } 21 | ], 22 | "apprunconf": [ 23 | { 24 | "setpath": "true", 25 | "setlibpath": "true", 26 | "setpythonpath": "false", 27 | "setpythonhome": "false", 28 | "setpythondontwritebytecode": "false", 29 | "setxdgdatadirs": "false", 30 | "setperllib": "false", 31 | "setgsettingsschemadir": "false", 32 | "setqtpluginpath": "false", 33 | "exec": "/usr/bin/yad" 34 | } 35 | ], 36 | "authors": [ 37 | { 38 | "type": "Author", 39 | "author": "YAD", 40 | "url": "YAD" 41 | }, 42 | { 43 | "type": "AppImage Maintainer", 44 | "author": "simonizor", 45 | "url": "http://www.simonizor.net" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /json/yadshot.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir/usr/bin", 6 | "cp ~/github/yadshot/yadshot.sh ~/.cache/deb2appimage/AppDir/usr/bin/yadshot.sh", 7 | "cp ~/github/yadshot/yadshot.desktop ~/.cache/deb2appimage/AppDir/usr/bin/yadshot.desktop", 8 | "cp ~/github/yadshot/yadshot.svg ~/.cache/deb2appimage/AppDir/usr/bin/yadshot.svg", 9 | "cp ~/bin/imagemagick ~/.cache/deb2appimage/AppDir/usr/bin/ImageMagick", 10 | "chmod a+x ~/.cache/deb2appimage/AppDir/usr/bin/yadshot.sh", 11 | "chmod a+x ~/.cache/deb2appimage/AppDir/usr/bin/ImageMagick" 12 | ], 13 | "name": "yadshot", 14 | "version": "0.2.02", 15 | "deps": "slop,libglew2.0,yad,libcairo2,libpango-1.0-0,libpangocairo-1.0-0,libgtk-3-0,xclip,libpng16-16,libpangoft2-1.0-0,grabc", 16 | "repoarch": "amd64", 17 | "distrorepo": "Debian", 18 | "repoversion": "stretch", 19 | "binarypath": "/usr/bin/yadshot.sh", 20 | "desktoppath": "/usr/bin/yadshot.desktop", 21 | "iconpath": "/usr/bin/yadshot.svg", 22 | "usewrapper": "true", 23 | "postrun": [ 24 | null 25 | ] 26 | } 27 | ], 28 | "apprunconf": [ 29 | { 30 | "setpath": "true", 31 | "setlibpath": "true", 32 | "setpythonpath": "false", 33 | "setpythonhome": "false", 34 | "setpythondontwritebytecode": "false", 35 | "setxdgdatadirs": "false", 36 | "setperllib": "false", 37 | "setgsettingsschemadir": "false", 38 | "setqtpluginpath": "false", 39 | "exec": "/usr/bin/yadshot.sh.wrapper" 40 | } 41 | ], 42 | "authors": [ 43 | { 44 | "type": "Author", 45 | "author": "YAD", 46 | "url": "YAD" 47 | }, 48 | { 49 | "type": "AppImage Maintainer", 50 | "author": "simonizor", 51 | "url": "http://www.simonizor.net" 52 | } 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /json/yata.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildinfo": [ 3 | { 4 | "prerun": [ 5 | "mkdir -p ~/.cache/deb2appimage/AppDir/usr/bin", 6 | "cp ~/github/yata/yata-loader ~/.cache/deb2appimage/AppDir/usr/bin/yata-loader", 7 | "chmod +x ~/.cache/deb2appimage/AppDir/usr/bin/yata-loader", 8 | "cd ~/.cache/deb2appimage/AppDir", 9 | "export LATEST_STABLE_ELECTRON=\"$(curl -sL \"https://electronjs.org/releases/stable\" | grep -m1 '

    /dev/null 2>&1 && exit 0 172 | 173 | # Exit immediately if $DESKTOPINTEGRATION is not empty 174 | if [ ! -z "$DESKTOPINTEGRATION" ] ; then 175 | exit 0 176 | fi 177 | 178 | # Check whether dependencies are present in base system (we do not bundle these) 179 | # http://cgit.freedesktop.org/xdg/desktop-file-utils/ 180 | check_dep desktop-file-validate 181 | check_dep update-desktop-database 182 | check_dep desktop-file-install 183 | check_dep xdg-icon-resource 184 | check_dep xdg-mime 185 | check_dep xdg-desktop-menu 186 | 187 | # Exit immediately if one of these files is present (disabled per app) 188 | check_prevent "$HOME/.local/share/$VENDORPREFIX/${APP}_no_desktopintegration" 189 | check_prevent "/usr/share/$VENDORPREFIX/${APP}_no_desktopintegration" 190 | check_prevent "/etc/$VENDORPREFIX/${APP}_no_desktopintegration" 191 | 192 | if [ ! -f "$DESKTOPFILE" ] ; then 193 | echo "Desktop file is missing. Please run ${THIS} from within an AppImage." 194 | exit 0 195 | fi 196 | 197 | if [ -z "$APPIMAGE" ] ; then 198 | APPIMAGE="$APPDIR/AppRun" 199 | # Not running from within an AppImage; hence using the AppRun for Exec= 200 | fi 201 | 202 | ICONFILE="$APPDIR/.DirIcon" 203 | 204 | # Check if the desktop file is already there 205 | # and if so, whether it points to the same AppImage 206 | if [ -e "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" ] ; then 207 | # echo "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME already there" 208 | EXEC=$(grep "^Exec=" "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" | head -n 1 | cut -d " " -f 1) 209 | # echo $EXEC 210 | if [ "Exec=\"$APPIMAGE\"" == "$EXEC" ] ; then 211 | exit 0 212 | fi 213 | fi 214 | 215 | # We ask the user only if we have found no reason to skip until here 216 | if [ -z "$SKIP" ] ; then 217 | set +e 218 | "$APPDIR/dialog" "AppImage - $APP_FULL" 219 | RETURN=$? 220 | set -e 221 | fi 222 | 223 | RET_LAUNCH_APP=0 # launch app 224 | RET_MENU_ENTRY=1 # create desktop menu entry 225 | RET_DISABLE_MESSAGE=2 # disable the desktopintegration message 226 | RET_CLOSE_WINDOW=3 # window was closed with ALT+F4/ESC/X-button 227 | 228 | if [ $RETURN -eq $RET_DISABLE_MESSAGE ] ; then 229 | mkdir -p "$STAMP_DIR" 230 | touch "$STAMP_DIR/${APP}_no_desktopintegration" 231 | exit 0 232 | elif [ $RETURN -eq $RET_MENU_ENTRY ] ; then 233 | SKIP= 234 | else 235 | exit 0 236 | fi 237 | 238 | # If the user has agreed, rewrite and install the desktop file, and the MIME information 239 | if [ -z "$SKIP" ] ; then 240 | # desktop-file-install is supposed to install .desktop files to the user's 241 | # applications directory when run as a non-root user, 242 | # and to /usr/share/applications if run as root 243 | # but that does not really work for me... 244 | # 245 | # For Exec we must use quotes 246 | # For TryExec quotes is not supported, so, space must be replaced to \s 247 | # https://askubuntu.com/questions/175404/how-to-add-space-to-exec-path-in-a-thumbnailer-descrption/175567 248 | RESOURCE_NAME=$(echo "$VENDORPREFIX-$DESKTOPFILE_NAME" | sed -e 's/.desktop//g') 249 | desktop-file-install --rebuild-mime-info-cache \ 250 | --vendor=$VENDORPREFIX --set-key=Exec --set-value="\"${APPIMAGE}\" %U" \ 251 | --set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \ 252 | --set-icon="$RESOURCE_NAME" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOPFILE" \ 253 | --dir "$DESTINATION_DIR_DESKTOP" 254 | chmod a+x "$DESTINATION_DIR_DESKTOP/"* 255 | # echo $RESOURCE_NAME 256 | 257 | # delete "Actions" entry and add an "Uninstall" action 258 | sed -i -e '/^Actions=/d' "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" 259 | cat >> "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" << EOF 260 | 261 | Actions=Uninstall; 262 | 263 | [Uninstall] 264 | Name=Remove desktop integration for $APP_FULL 265 | Exec="$APPIMAGE" --remove-appimage-desktop-integration 266 | 267 | EOF 268 | 269 | # Install the icon files for the application; TODO: scalable 270 | ICON="$(dir -Cw1 ${APPDIR} | grep -m1 '.png')" 271 | ICON_SIZE=$(file ${APPDIR}/${ICON} | cut -f2 -d',' | tr -d '[:blank:]' | cut -f1 -d'x') 272 | xdg-icon-resource install --context apps --size ${ICON_SIZE} "${APPDIR}"/"${ICON}" "${RESOURCE_NAME}" 273 | 274 | # Install mime type 275 | find "${APPDIR}/usr/share/mime/" -type f -name *xml -exec xdg-mime install $SYSTEM_WIDE --novendor {} \; 2>/dev/null || true 276 | 277 | # Install the icon files for the mime type; TODO: scalable 278 | ICONS=$(find "${APPDIR}/usr/share/icons/" -iwholename "*/mimetypes/*.png" 2>/dev/null || true) 279 | for ICON in $ICONS ; do 280 | ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1) 281 | xdg-icon-resource install --context mimetypes --size ${ICON_SIZE} "${ICON}" $(basename $ICON | sed -e 's/.png//g') 282 | done 283 | 284 | xdg-desktop-menu forceupdate 285 | gtk-update-icon-cache # for MIME 286 | fi 287 | -------------------------------------------------------------------------------- /resources/fltk-dialog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoniz0r/deb2appimage/cb1b333c00d424dab801b80404a4b3594fb466c1/resources/fltk-dialog -------------------------------------------------------------------------------- /scripts/code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # script to build, update, and launch VSCode AppImage 3 | 4 | # Get current location 5 | RUNNING_LOC="$(readlink -f "$(dirname "$0")")" 6 | # function to build vscode AppImage using deb2appimage 7 | vscode_build() { 8 | unset VSCODE_SAVE_DIR 9 | # tell user to choose dir 10 | fltk-dialog --message --close-label="Ok" --center --text="Please choose where you would like to save the AppImage of Visual Studio Code." 11 | cd "$HOME" 12 | # set VSCODE_SAVE_DIR to directory user chooses 13 | export VSCODE_SAVE_DIR="$(fltk-dialog --directory --center)" 14 | # return 1 if no dir chosen 15 | if [[ -z "$VSCODE_SAVE_DIR" ]]; then 16 | return 1 17 | fi 18 | # use deb2appimage to build latest vscode version 19 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Building Visual Studio Code AppImage..." & 20 | PROGRESS_PID=$! 21 | deb2appimage -j "$RUNNING_LOC"/vscode.json -o ~/.cache 22 | kill -SIGTERM -f $PROGRESS_PID 23 | if [[ ! -f "$HOME/.cache/vscode-latest-x86_64.AppImage" ]]; then 24 | return 1 25 | fi 26 | # check if directory is writable 27 | if [[ -w "$VSCODE_SAVE_DIR" ]]; then 28 | mkdir -p "$VSCODE_SAVE_DIR" || \ 29 | { fltk-dialog --message --close-label="Ok" --center --text="Failed to create $VSCODE_SAVE_DIR!\nPlease try again."; rm -f ~/.cache/vscode-latest-x86_64.AppImage; return 1; } 30 | mv ~/.cache/vscode-latest-x86_64.AppImage "$VSCODE_SAVE_DIR"/code || \ 31 | { fltk-dialog --message --close-label="Ok" --center --text="Failed to move Visual Studio Code to $VSCODE_SAVE_DIR!\nPlease try again."; rm -f ~/.cache/vscode-latest-x86_64.AppImage; return 1; } 32 | else 33 | # get password if not writable for use with sudo 34 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to save Visual Studio Code to $VSCODE_SAVE_DIR")" 35 | echo "$PASSWORD" | sudo -S mkdir -p "$VSCODE_SAVE_DIR" || \ 36 | { fltk-dialog --message --close-label="Ok" --center --text="Failed to create $VSCODE_SAVE_DIR!\nPlease try again."; rm -f ~/.cache/vscode-latest-x86_64.AppImage; return 1; } 37 | echo "$PASSWORD" | sudo -S mv ~/.cache/vscode-latest-x86_64.AppImage "$VSCODE_SAVE_DIR"/code || \ 38 | { fltk-dialog --message --close-label="Ok" --center --text="Failed to move Visual Studio Code to $VSCODE_SAVE_DIR!\nPlease try again."; rm -f ~/.cache/vscode-latest-x86_64.AppImage; return 1; } 39 | fi 40 | # if moved to VSCODE_SAVE_DIR, return 0 otherwise return 1 41 | if [[ -f "$VSCODE_SAVE_DIR/code" ]]; then 42 | return 0 43 | else 44 | return 1 45 | fi 46 | } 47 | # function to check for vscode update 48 | vscode_update() { 49 | unset CURRENT_VSCODE_VER NEW_VSCODE_VER 50 | # get current version from .version file 51 | export CURRENT_VSCODE_VER="$(cat "$RUNNING_LOC"/.version)" 52 | # get latest version from header of deb download location 53 | export NEW_VSCODE_VER="$(curl -sLIX HEAD 'https://update.code.visualstudio.com/latest/linux-deb-x64/stable' | grep -m1 'Location: ' | cut -f2 -d'_')" 54 | # return 1 if either version is missing 55 | if [[ -z "$NEW_VSCODE_VER" || -z "$CURRENT_VSCODE_VER" ]]; then 56 | return 1 57 | fi 58 | # return 0 if versions match 59 | if [[ "$CURRENT_VSCODE_VER" == "$NEW_VSCODE_VER" ]]; then 60 | return 0 61 | fi 62 | # ask user if they want to update 63 | fltk-dialog --question \ 64 | --center \ 65 | --text="A new version of Visual Studio Code is available.\nCurrent version: $CURRENT_VSCODE_VER\nNew version: $NEW_VSCODE_VER\nUpdate Visual Studio Code to $NEW_VSCODE_VER now?" 66 | case $? in 67 | 0) sleep 0;; 68 | *) return 0;; 69 | esac 70 | # build vscode AppImage 71 | vscode_build 72 | # check exit status of vscode_build function 73 | case $? in 74 | 0) return 0;; 75 | *) return 1;; 76 | esac 77 | } 78 | # check vscode update if .version file exists otherwise build vscode AppImage 79 | if [[ -f "$RUNNING_LOC/.version" ]]; then 80 | vscode_update 81 | else 82 | vscode_build 83 | fi 84 | # check exit status of ran function 85 | case $? in 86 | 0) 87 | # if versions match, run RUNNING_DIR/code 88 | if [[ "$CURRENT_VSCODE_VER" == "$NEW_VSCODE_VER" ]]; then 89 | "$RUNNING_LOC"/code 90 | # otherwise assume new AppImage built and run new AppImage 91 | else 92 | "$VSCODE_SAVE_DIR"/code 93 | fi 94 | ;; 95 | *) 96 | fltk-dialog --message --close-label="Ok" --center --text="Failed to update or build Visual Studio Code." 97 | # if RUNNING_LOC/code exists, run it 98 | if [[ -f "$RUNNING_LOC/code" ]]; then 99 | "$RUNNING_LOC"/code 100 | # otherwise assume initial build failed and exit 101 | else 102 | exit 1 103 | fi 104 | ;; 105 | esac 106 | -------------------------------------------------------------------------------- /scripts/discord-canary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REALPATH="$(readlink -f $0)" 4 | RUNNING_DIR="$(dirname "$REALPATH")" 5 | 6 | function updatediscordcanary() { 7 | APP_VERSION="$(cat "$RUNNING_DIR"/discord-canary-version)" 8 | NEW_APP_VERSION="$(curl -sSL -I -X GET "https://discordapp.com/api/download/canary?platform=linux&format=tar.gz" | grep -im1 '^location:' | rev | cut -f1 -d'-' | cut -f3- -d'.' | rev)" 9 | if [[ ! -z "$NEW_APP_VERSION" ]] && [[ ! "$APP_VERSION" == "$NEW_APP_VERSION" ]]; then 10 | GITHUB_DL_URL="https://github.com/simoniz0r/Discord-Canary-AppImage/releases/download/v$NEW_APP_VERSION/discord-canary-$NEW_APP_VERSION-x86_64.AppImage" 11 | if [[ "$(curl -sL -I -X HEAD "$GITHUB_DL_URL" | grep -m1 '^Status:' | cut -f2 -d' ')" == "302" ]]; then 12 | fltk-dialog --question --center --text="New Discord Canary version has been released!\nDownload version $NEW_APP_VERSION now?" 13 | case $? in 14 | 1) 15 | exit 0 16 | ;; 17 | esac 18 | fltk-dialog --message --center --text="Please choose the save location for 'discord-canary'" 19 | DEST_DIR="$(fltk-dialog --directory --center --native)" 20 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 21 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 22 | DEST_DIR="$HOME/Downloads" 23 | fi 24 | mkdir -p ~/.cache/discord-canary-appimage 25 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord Canary" & 26 | PROGRESS_PID=$! 27 | curl -sSL -o ~/.cache/discord-canary-appimage/discord-canary "$GITHUB_DL_URL" || { fltk-dialog --warning --center --text="Failed to download Discord Canary!\nPlease try again."; exit 1; } 28 | chmod +x ~/.cache/discord-canary-appimage/discord-canary 29 | kill -SIGTERM -f $PROGRESS_PID 30 | if [[ -w "$DEST_DIR" ]]; then 31 | mkdir -p "$DEST_DIR" 32 | mv ~/.cache/discord-canary-appimage/discord-canary "$DEST_DIR"/discord-canary 33 | else 34 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to download Discord Canary to $DEST_DIR")" 35 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 36 | echo "$PASSWORD" | sudo -S mv ~/.cache/discord-canary-appimage/discord-canary "$DEST_DIR"/discord-canary || \ 37 | { fltk-dialog --warning --center --text="Failed to move Discord Canary to $DEST_DIR!\nPlease try again."; rm -f ~/.cache/discord-canary-appimage/discord-canary; exit 1; } 38 | kill -SIGTERM -f $PROGRESS_PID 39 | fi 40 | rm -rf ~/.cache/discord-canary-appimage 41 | fltk-dialog --message --center --text="Discord Canary $NEW_APP_VERSION has been downloaded to $DEST_DIR\nLaunching Discord Canary now..." 42 | "$DEST_DIR"/discord-canary & 43 | exit 0 44 | else 45 | fltk-dialog --question --center --text="New Discord Canary version has been released!\nUse deb2appimage to build an AppImage for $NEW_APP_VERSION now?" 46 | case $? in 47 | 1) 48 | exit 0 49 | ;; 50 | esac 51 | mkdir -p "$HOME"/.cache/deb2appimage/usr/bin 52 | mkdir -p "$HOME"/.cache/discord-canary-appimage 53 | fltk-dialog --message --center --text="Please choose the save location for 'discord-canary'" 54 | DEST_DIR="$(fltk-dialog --directory --center --native)" 55 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 56 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 57 | DEST_DIR="$HOME/Downloads" 58 | fi 59 | if [[ -w "$DEST_DIR" ]]; then 60 | mkdir -p "$DEST_DIR" 61 | else 62 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to build Discord Canary AppImage to $DEST_DIR")" 63 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 64 | fi 65 | # cp "$RUNNING_DIR"/deb2appimage "$HOME"/.cache/deb2appimage/usr/bin/deb2appimage.AppImage 66 | # cp "$RUNNING_DIR"/fltk-dialog "$HOME"/.cache/deb2appimage/usr/bin/fltk-dialog 67 | # cp "$RUNNING_DIR"/discord-canary.sh "$HOME"/.cache/deb2appimage/usr/bin/discord-canary.sh 68 | # cp "$RUNNING_DIR"/discord-canary.json "$HOME"/.cache/deb2appimage/usr/bin/discord-canary.json 69 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord Canary" & 70 | PROGRESS_PID=$! 71 | deb2appimage -j "$RUNNING_DIR"/discord-canary.json -o "$HOME"/.cache/discord-canary-appimage || { fltk-dialog --warning --center --text="Failed to build Discord Canary AppImage\nPlease create an issue here:\nhttps://github.com/simoniz0r/Discord-Canary-AppImage/issues/new"; exit 1; } 72 | kill -SIGTERM -f $PROGRESS_PID 73 | if [[ -w "$DEST_DIR" ]]; then 74 | mv "$HOME"/.cache/discord-canary-appimage/discord-canary-latest-x86_64.AppImage "$DEST_DIR"/discord-canary 75 | else 76 | echo "$PASSWORD" | sudo -S mv "$HOME"/.cache/discord-canary-appimage/discord-canary-latest-x86_64.AppImage "$DEST_DIR"/discord-canary || \ 77 | { fltk-dialog --warning --center --text="Failed to move Discord Canary to $DEST_DIR!\nPlease try again."; rm -f "$HOME"/.cache/discord-canary-appimage/discord-canary-latest-x86_64.AppImage; exit 1; } 78 | fi 79 | fltk-dialog --message --center --text="Discord Canary AppImage $NEW_APP_VERSION has been built to $DEST_DIR\nLaunching Discord Canary now..." 80 | rm -rf "$HOME"/.cache/discord-canary-appimage 81 | "$DEST_DIR"/discord-canary & 82 | exit 0 83 | fi 84 | else 85 | echo "$APP_VERSION" 86 | echo "Discord Canary is up to date" 87 | echo 88 | fi 89 | } 90 | 91 | case $1 in 92 | --remove) 93 | "$RUNNING_DIR"/discord-canary.wrapper --remove-appimage-desktop-integration && echo "Removed .desktop file and icon for menu integration for Discord Canary." || echo "Failed to remove .desktop file and icon!" 94 | exit 0 95 | ;; 96 | --help) 97 | echo "Arguments provided by Discord Canary AppImage:" 98 | echo "--remove - Remove .desktop file and icon for menu integration if created by the AppImage." 99 | echo "--help - Show this help output." 100 | echo 101 | echo "All other arguments will be passed to Discord Canary; any valid arguments will function the same as a regular Discord Canary install." 102 | exit 0 103 | ;; 104 | *) 105 | if ! type curl > /dev/null 2>&1; then 106 | fltk-dialog --message --center --text="Please install 'curl' to enable update checks" 107 | else 108 | updatediscordcanary 109 | fi 110 | "$RUNNING_DIR"/discord-canary.wrapper & 111 | sleep 30 112 | while ps aux | grep -v 'grep' | grep -q 'DiscordCanary'; do 113 | sleep 30 114 | done 115 | exit 0 116 | ;; 117 | esac 118 | -------------------------------------------------------------------------------- /scripts/discord-ptb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REALPATH="$(readlink -f $0)" 4 | RUNNING_DIR="$(dirname "$REALPATH")" 5 | 6 | function updatediscordptb() { 7 | APP_VERSION="$(cat "$RUNNING_DIR"/discord-ptb-version)" 8 | NEW_APP_VERSION="$(curl -sSL -I -X GET "https://discordapp.com/api/download/ptb?platform=linux&format=tar.gz" | grep -im1 '^location:' | rev | cut -f1 -d'-' | cut -f3- -d'.' | rev)" 9 | if [[ ! -z "$NEW_APP_VERSION" ]] && [[ ! "$APP_VERSION" == "$NEW_APP_VERSION" ]]; then 10 | GITHUB_DL_URL="https://github.com/simoniz0r/Discord-PTB-AppImage/releases/download/v$NEW_APP_VERSION/discord-ptb-$NEW_APP_VERSION-x86_64.AppImage" 11 | if [[ "$(curl -sL -I -X HEAD "$GITHUB_DL_URL" | grep -m1 '^Status:' | cut -f2 -d' ')" == "302" ]]; then 12 | fltk-dialog --question --center --text="New Discord PTB version has been released!\nDownload version $NEW_APP_VERSION now?" 13 | case $? in 14 | 1) 15 | exit 0 16 | ;; 17 | esac 18 | fltk-dialog --message --center --text="Please choose the save location for 'discord-ptb'" 19 | DEST_DIR="$(fltk-dialog --directory --center --native)" 20 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 21 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 22 | DEST_DIR="$HOME/Downloads" 23 | fi 24 | mkdir -p ~/.cache/discord-ptb-appimage 25 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord PTB" & 26 | PROGRESS_PID=$! 27 | curl -sSL -o ~/.cache/discord-ptb-appimage/discord-ptb "$GITHUB_DL_URL" || { fltk-dialog --warning --center --text="Failed to download Discord PTB!\nPlease try again."; exit 1; } 28 | chmod +x ~/.cache/discord-ptb-appimage/discord-ptb 29 | kill -SIGTERM -f $PROGRESS_PID 30 | if [[ -w "$DEST_DIR" ]]; then 31 | mkdir -p "$DEST_DIR" 32 | mv ~/.cache/discord-ptb-appimage/discord-ptb "$DEST_DIR"/discord-ptb 33 | else 34 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to download Discord PTB to $DEST_DIR")" 35 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 36 | echo "$PASSWORD" | sudo -S mv ~/.cache/discord-ptb-appimage/discord-ptb "$DEST_DIR"/discord-ptb || \ 37 | { fltk-dialog --warning --center --text="Failed to move Discord PTB to $DEST_DIR!\nPlease try again."; rm -f ~/.cache/discord-ptb-appimage/discord-ptb; exit 1; } 38 | kill -SIGTERM -f $PROGRESS_PID 39 | fi 40 | rm -rf ~/.cache/discord-ptb-appimage 41 | fltk-dialog --message --center --text="Discord PTB $NEW_APP_VERSION has been downloaded to $DEST_DIR\nLaunching Discord PTB now..." 42 | "$DEST_DIR"/discord-ptb & 43 | exit 0 44 | else 45 | fltk-dialog --question --center --text="New Discord PTB version has been released!\nUse deb2appimage to build an AppImage for $NEW_APP_VERSION now?" 46 | case $? in 47 | 1) 48 | exit 0 49 | ;; 50 | esac 51 | mkdir -p "$HOME"/.cache/deb2appimage/usr/bin 52 | mkdir -p "$HOME"/.cache/discord-ptb-appimage 53 | fltk-dialog --message --center --text="Please choose the save location for 'discord-ptb'" 54 | DEST_DIR="$(fltk-dialog --directory --center --native)" 55 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 56 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 57 | DEST_DIR="$HOME/Downloads" 58 | fi 59 | if [[ -w "$DEST_DIR" ]]; then 60 | mkdir -p "$DEST_DIR" 61 | else 62 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to build Discord PTB AppImage to $DEST_DIR")" 63 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 64 | fi 65 | # cp "$RUNNING_DIR"/deb2appimage "$HOME"/.cache/deb2appimage/usr/bin/deb2appimage.AppImage 66 | # cp "$RUNNING_DIR"/fltk-dialog "$HOME"/.cache/deb2appimage/usr/bin/fltk-dialog 67 | # cp "$RUNNING_DIR"/discord-ptb.sh "$HOME"/.cache/deb2appimage/usr/bin/discord-ptb.sh 68 | # cp "$RUNNING_DIR"/discord-ptb.json "$HOME"/.cache/deb2appimage/usr/bin/discord-ptb.json 69 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord PTB" & 70 | PROGRESS_PID=$! 71 | deb2appimage -j "$RUNNING_DIR"/discord-ptb.json -o "$HOME"/.cache/discord-ptb-appimage || { fltk-dialog --warning --center --text="Failed to build Discord PTB AppImage\nPlease create an issue here:\nhttps://github.com/simoniz0r/Discord-PTB-AppImage/issues/new"; exit 1; } 72 | kill -SIGTERM -f $PROGRESS_PID 73 | if [[ -w "$DEST_DIR" ]]; then 74 | mv "$HOME"/.cache/discord-ptb-appimage/discord-ptb-latest-x86_64.AppImage "$DEST_DIR"/discord-ptb 75 | else 76 | echo "$PASSWORD" | sudo -S mv "$HOME"/.cache/discord-ptb-appimage/discord-ptb-latest-x86_64.AppImage "$DEST_DIR"/discord-ptb || \ 77 | { fltk-dialog --warning --center --text="Failed to move Discord PTB to $DEST_DIR!\nPlease try again."; rm -f "$HOME"/.cache/discord-ptb-appimage/discord-ptb-latest-x86_64.AppImage; exit 1; } 78 | fi 79 | fltk-dialog --message --center --text="Discord PTB AppImage $NEW_APP_VERSION has been built to $DEST_DIR\nLaunching Discord PTB now..." 80 | rm -rf "$HOME"/.cache/discord-ptb-appimage 81 | "$DEST_DIR"/discord-ptb & 82 | exit 0 83 | fi 84 | else 85 | echo "$APP_VERSION" 86 | echo "Discord PTB is up to date" 87 | echo 88 | fi 89 | } 90 | 91 | case $1 in 92 | --remove) 93 | "$RUNNING_DIR"/discord-ptb.wrapper --remove-appimage-desktop-integration && echo "Removed .desktop file and icon for menu integration for Discord PTB." || echo "Failed to remove .desktop file and icon!" 94 | exit 0 95 | ;; 96 | --help) 97 | echo "Arguments provided by Discord PTB AppImage:" 98 | echo "--remove - Remove .desktop file and icon for menu integration if created by the AppImage." 99 | echo "--help - Show this help output." 100 | echo 101 | echo "All other arguments will be passed to Discord PTB; any valid arguments will function the same as a regular Discord PTB install." 102 | exit 0 103 | ;; 104 | *) 105 | if ! type curl > /dev/null 2>&1; then 106 | fltk-dialog --message --center --text="Please install 'curl' to enable update checks" 107 | else 108 | updatediscordptb 109 | fi 110 | "$RUNNING_DIR"/discord-ptb.wrapper & 111 | sleep 30 112 | while ps aux | grep -v 'grep' | grep -q 'DiscordPTB'; do 113 | sleep 30 114 | done 115 | exit 0 116 | ;; 117 | esac 118 | -------------------------------------------------------------------------------- /scripts/discord-stable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REALPATH="$(readlink -f $0)" 4 | RUNNING_DIR="$(dirname "$REALPATH")" 5 | 6 | function updatediscordstable() { 7 | APP_VERSION="$(cat "$RUNNING_DIR"/discord-version)" 8 | NEW_APP_VERSION="$(curl -sSL -I -X GET "https://discordapp.com/api/download?platform=linux&format=tar.gz" | grep -im1 '^location:' | rev | cut -f1 -d'-' | cut -f3- -d'.' | rev)" 9 | if [[ ! -z "$NEW_APP_VERSION" ]] && [[ ! "$APP_VERSION" == "$NEW_APP_VERSION" ]]; then 10 | GITHUB_DL_URL="https://github.com/simoniz0r/Discord-AppImage/releases/download/v$NEW_APP_VERSION/discord-$NEW_APP_VERSION-x86_64.AppImage" 11 | if [[ "$(curl -sL -I -X HEAD "$GITHUB_DL_URL" | grep -m1 '^Status:' | cut -f2 -d' ')" == "302" ]]; then 12 | fltk-dialog --question --center --text="New Discord version has been released!\nDownload version $NEW_APP_VERSION now?" 13 | case $? in 14 | 1) 15 | exit 0 16 | ;; 17 | esac 18 | fltk-dialog --message --center --text="Please choose the save location for 'discord'" 19 | DEST_DIR="$(fltk-dialog --directory --center --native)" 20 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 21 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 22 | DEST_DIR="$HOME/Downloads" 23 | fi 24 | mkdir -p ~/.cache/discord-appimage 25 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord" & 26 | PROGRESS_PID=$! 27 | curl -sSL -o ~/.cache/discord-appimage/discord "$GITHUB_DL_URL" || { fltk-dialog --warning --center --text="Failed to download Discord!\nPlease try again."; exit 1; } 28 | chmod +x ~/.cache/discord-appimage/discord 29 | kill -SIGTERM -f $PROGRESS_PID 30 | if [[ -w "$DEST_DIR" ]]; then 31 | mkdir -p "$DEST_DIR" 32 | mv ~/.cache/discord-appimage/discord "$DEST_DIR"/discord 33 | else 34 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to download Discord to $DEST_DIR")" 35 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 36 | echo "$PASSWORD" | sudo -S mv ~/.cache/discord-appimage/discord "$DEST_DIR"/discord || \ 37 | { fltk-dialog --warning --center --text="Failed to move Discord to $DEST_DIR!\nPlease try again."; rm -f ~/.cache/discord-appimage/discord; exit 1; } 38 | kill -SIGTERM -f $PROGRESS_PID 39 | fi 40 | rm -rf ~/.cache/discord-appimage 41 | fltk-dialog --message --center --text="Discord $NEW_APP_VERSION has been downloaded to $DEST_DIR\nLaunching Discord now..." 42 | "$DEST_DIR"/discord & 43 | exit 0 44 | else 45 | fltk-dialog --question --center --text="New Discord version has been released!\nUse deb2appimage to build an AppImage for $NEW_APP_VERSION now?" 46 | case $? in 47 | 1) 48 | exit 0 49 | ;; 50 | esac 51 | mkdir -p "$HOME"/.cache/deb2appimage/usr/bin 52 | mkdir -p "$HOME"/.cache/discord-appimage 53 | fltk-dialog --message --center --text="Please choose the save location for 'discord'" 54 | DEST_DIR="$(fltk-dialog --directory --center --native)" 55 | if [[ -z "$DEST_DIR" ]] || [[ "$DEST_DIR" =~ "/tmp/." ]]; then 56 | fltk-dialog --message --center --text="Invalid directory selected; using $HOME/Downloads" 57 | DEST_DIR="$HOME/Downloads" 58 | fi 59 | if [[ -w "$DEST_DIR" ]]; then 60 | mkdir -p "$DEST_DIR" 61 | else 62 | PASSWORD="$(fltk-dialog --password --center --text="Enter your password to build Discord AppImage to $DEST_DIR")" 63 | echo "$PASSWORD" | sudo -S mkdir -p "$DEST_DIR" || { fltk-dialog --warning --center --text="Failed to create $DEST_DIR!\nPlease try again."; exit 1; } 64 | fi 65 | # cp "$RUNNING_DIR"/deb2appimage "$HOME"/.cache/deb2appimage/usr/bin/deb2appimage.AppImage 66 | # cp "$RUNNING_DIR"/fltk-dialog "$HOME"/.cache/deb2appimage/usr/bin/fltk-dialog 67 | # cp "$RUNNING_DIR"/discord-stable.sh "$HOME"/.cache/deb2appimage/usr/bin/discord-stable.sh 68 | # cp "$RUNNING_DIR"/discord-stable.json "$HOME"/.cache/deb2appimage/usr/bin/discord-stable.json 69 | fltk-dialog --progress --center --pulsate --no-cancel --no-escape --text="Downloading Discord" & 70 | PROGRESS_PID=$! 71 | deb2appimage -j "$RUNNING_DIR"/discord-stable.json -o "$HOME"/.cache/discord-appimage || { fltk-dialog --warning --center --text="Failed to build Discord AppImage\nPlease create an issue here:\nhttps://github.com/simoniz0r/Discord-AppImage/issues/new"; exit 1; } 72 | kill -SIGTERM -f $PROGRESS_PID 73 | if [[ -w "$DEST_DIR" ]]; then 74 | mv "$HOME"/.cache/discord-appimage/discord-latest-x86_64.AppImage "$DEST_DIR"/discord 75 | else 76 | echo "$PASSWORD" | sudo -S mv "$HOME"/.cache/discord-appimage/discord-latest-x86_64.AppImage "$DEST_DIR"/discord || \ 77 | { fltk-dialog --warning --center --text="Failed to move Discord to $DEST_DIR!\nPlease try again."; rm -f "$HOME"/.cache/discord-appimage/discord-latest-x86_64.AppImage; exit 1; } 78 | fi 79 | fltk-dialog --message --center --text="Discord AppImage $NEW_APP_VERSION has been built to $DEST_DIR\nLaunching Discord now..." 80 | rm -rf "$HOME"/.cache/discord-appimage 81 | "$DEST_DIR"/discord & 82 | exit 0 83 | fi 84 | else 85 | echo "$APP_VERSION" 86 | echo "Discord is up to date" 87 | echo 88 | fi 89 | } 90 | 91 | case $1 in 92 | --remove) 93 | "$RUNNING_DIR"/discord.wrapper --remove-appimage-desktop-integration && echo "Removed .desktop file and icon for menu integration for Discord." || echo "Failed to remove .desktop file and icon!" 94 | exit 0 95 | ;; 96 | --help) 97 | echo "Arguments provided by Discord AppImage:" 98 | echo "--remove - Remove .desktop file and icon for menu integration if created by the AppImage." 99 | echo "--help - Show this help output." 100 | echo 101 | echo "All other arguments will be passed to Discord; any valid arguments will function the same as a regular Discord install." 102 | exit 0 103 | ;; 104 | *) 105 | if ! type curl > /dev/null 2>&1; then 106 | fltk-dialog --message --center --text="Please install 'curl' to enable update checks" 107 | else 108 | updatediscordstable 109 | fi 110 | "$RUNNING_DIR"/discord.wrapper & 111 | sleep 30 112 | while ps aux | grep -v 'grep' | grep -q 'Discord'; do 113 | sleep 30 114 | done 115 | exit 0 116 | ;; 117 | esac 118 | -------------------------------------------------------------------------------- /scripts/imagewriter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RUNNING_DIR="$(readlink -f $(dirname $0))" 4 | 5 | cp -r "$RUNNING_DIR"/RosaImageWriter /tmp/RosaImageWriter 6 | xdg-su -c /tmp/RosaImageWriter/RosaImageWriter 7 | rm -rf /tmp/RosaImageWriter 8 | --------------------------------------------------------------------------------