├── .DirIcon ├── AppRun ├── README.md ├── shradiko.desktop ├── shradiko.svg └── usr ├── bin ├── appimagetool └── shradiko-apt ├── lib └── shradiko │ ├── AppRun │ ├── shradiko │ ├── shradiko-apt │ └── shradiko-apt-install └── share ├── applications └── shradiko.desktop └── icons └── hicolor └── scalable └── apps └── shradiko.svg /.DirIcon: -------------------------------------------------------------------------------- 1 | shradiko.svg -------------------------------------------------------------------------------- /AppRun: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/universe-software/shradiko/df2ca80e78a99b31c6f2674dc53217a27fa22a58/AppRun -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shradiko 2 | ## Make Portable AppImages from Distro Packages 3 | 4 | Shradiko is a tool for making portable AppImages from distro packages. Currently, it only supports DEB packages. 5 | 6 | ## How 7 | 8 | Shradiko works by installing the package and its dependencies onto a minimal package manager installation inside a chroot (currently Ubuntu Base 20.04), which is stored in the AppImage. When the AppImage is run, it creates a new mount namespace and mounts overlay filesystems onto several system directories to make the package think it is installed on the system. That way, even non-portable packages can be used portably. 9 | 10 | ## Notes 11 | 12 | * To build the AppImage, Shradiko must be run as root 13 | * Shradiko requires an internet connection to download Ubuntu Base and any package dependencies 14 | * Since Shradiko uses overlay filesystems, the packaged program should not expect changes to files in system directories to be permanent. For example, editing files in `/etc` with a packaged text editor will not actually change those files permanently. Changes to files in user home directories will still be permanent. 15 | * The program will think it is running as root. Some programs refuse to run as root or require special options for that to work. For example Chromium requires the `--no-sandbox` flag to run as root. This does not, however, give actual root permissions. 16 | * See the *Troubleshooting* guide below 17 | 18 | ## Installation 19 | 20 | Shradiko is itself an AppImage. Go to [the releases page](https://github.com/universe-software/shradiko/releases) and download the latest `shradiko-apt`. Then, to make it executable, run the following in a terminal opened to the directory with `shradiko-apt`: 21 | 22 | ```bash 23 | chmod +x shradiko-apt 24 | ``` 25 | 26 | ## Usage 27 | 28 | **Shradiko requires root permissions.** To build an AppImage with Shradiko, you need: 29 | 30 | * A `.deb` package file 31 | * A [desktop entry file](https://wiki.archlinux.org/title/Desktop_entries) - Note that if you use the desktop entry from inside the package, some packages have entries that use unregistered categories, which AppImageKit forbids. Edit the desktop entry and remove any `Categories` that aren't in the [registered categories list](https://specifications.freedesktop.org/menu-spec/latest/apa.html) first. 32 | * An icon file (`.png` or `.svg`) with a base name that matches the `Icon` value in the desktop entry 33 | 34 | **Shradiko requires provided file paths to be absolute.** To easily do so for files in the current directory, provide paths with `"$(pwd)/..."`. To build an AppImage, assuming `shradiko-apt` and the necessary files are in the current directory, run: 35 | 36 | ``` 37 | sudo ./shradiko-apt "$(pwd)/PACKAGE.deb" COMMAND "$(pwd)/DESKTOP_ENTRY.desktop" "$(pwd)/ICON" "$(pwd)/PACKAGE.AppImage" 38 | ``` 39 | 40 | replacing `PACKAGE.deb` with the name of your DEB file, `COMMAND` with the command to use to start the installed program (e.g. if you installed LibreOffice Writer, the command would be `lowriter`), `DESKTOP_ENTRY.desktop` with the name of your desktop entry, `ICON` with the name of you icon file (including `.png` or `.svg extension`), and `PACKAGE.AppImage` with the name you want to give your new AppImage. 41 | 42 | Shradiko will then download and extract Ubuntu Base, install the package and its dependencies, clean up, and wrap the environment in an AppImage. To allow your regular user profile to access the AppImage, run 43 | 44 | ``` 45 | sudo chown $USERNAME:$USERNAME PACKAGE.AppImage 46 | ``` 47 | 48 | Replacing `PACKAGE.AppImage` with the name of your AppImage file. 49 | 50 | ## Troubleshooting 51 | 52 | Sometimes, if Shradiko fails or is interrupted, trying to run it again will give errors when trying to delete the old instance files because some directories are still mounted. If this happens, use the following commands to unmount those directories first: 53 | 54 | ``` 55 | sudo fuser -km /root/.shradiko/AppImage/root/dev 56 | sudo umount /root/.shradiko/AppImage/root/dev 57 | sudo fuser -km /root/.shradiko/AppImage/root/tmp 58 | sudo umount /root/.shradiko/AppImage/root/tmp 59 | sudo fuser -km /root/.shradiko/AppImage/root/proc 60 | sudo umount /root/.shradiko/AppImage/root/proc 61 | ``` -------------------------------------------------------------------------------- /shradiko.desktop: -------------------------------------------------------------------------------- 1 | usr/share/applications/shradiko.desktop -------------------------------------------------------------------------------- /shradiko.svg: -------------------------------------------------------------------------------- 1 | usr/share/icons/hicolor/scalable/apps/shradiko.svg -------------------------------------------------------------------------------- /usr/bin/appimagetool: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/universe-software/shradiko/df2ca80e78a99b31c6f2674dc53217a27fa22a58/usr/bin/appimagetool -------------------------------------------------------------------------------- /usr/bin/shradiko-apt: -------------------------------------------------------------------------------- 1 | ../lib/shradiko/shradiko-apt -------------------------------------------------------------------------------- /usr/lib/shradiko/AppRun: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | unshare -rm "$(dirname "$(realpath "$0")")/shradiko" "$@" -------------------------------------------------------------------------------- /usr/lib/shradiko/shradiko: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | overlay="$(dirname "$(realpath "$0")")/root" 4 | program="PROGRAM" 5 | 6 | dir="$(mktemp -d)" 7 | mkdir -p "$dir/work" 8 | rm -rf "$dir/work" 9 | mkdir -p "$dir/work/bin" 10 | mkdir -p "$dir/work/sbin" 11 | mkdir -p "$dir/work/lib" 12 | mkdir -p "$dir/work/usr" 13 | mkdir -p "$dir/work/etc" 14 | mkdir -p "$dir/work/var" 15 | mkdir -p "$dir/work/opt" 16 | 17 | mkdir -p "$dir/overlay/bin" 18 | mkdir -p "$dir/overlay/sbin" 19 | mkdir -p "$dir/overlay/lib" 20 | mkdir -p "$dir/overlay/usr" 21 | mkdir -p "$dir/overlay/etc" 22 | mkdir -p "$dir/overlay/var" 23 | mkdir -p "$dir/overlay/opt" 24 | 25 | mount -t overlay overlay-usr -o "lowerdir=$overlay/usr:/usr,upperdir=$dir/overlay/usr,workdir=$dir/work/usr" /usr 26 | mount -t overlay overlay-etc -o "lowerdir=$overlay/etc:/etc,upperdir=$dir/overlay/etc,workdir=$dir/work/etc" /etc 27 | mount -t overlay overlay-var -o "lowerdir=$overlay/var:/var,upperdir=$dir/overlay/var,workdir=$dir/work/var" /var 28 | mount -t overlay overlay-bin -o "lowerdir=$overlay/bin:/bin,upperdir=$dir/overlay/bin,workdir=$dir/work/bin" /bin 29 | mount -t overlay overlay-lib -o "lowerdir=$overlay/lib:/lib,upperdir=$dir/overlay/lib,workdir=$dir/work/lib" /lib 30 | mount -t overlay overlay-sbin -o "lowerdir=$overlay/sbin:/sbin,upperdir=$dir/overlay/sbin,workdir=$dir/work/sbin" /sbin 31 | mount -t overlay overlay-opt -o "lowerdir=$overlay/opt:/opt,upperdir=$dir/overlay/opt,workdir=$dir/work/opt" /opt 32 | 33 | "$program" "$@" 34 | rm -rf "$dir" -------------------------------------------------------------------------------- /usr/lib/shradiko/shradiko-apt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Usage: shradiko-apt DEB_FILE PROGRAM DESKTOP_ENTRY ICON_FILE OUT 3 | 4 | if [ "$#" -eq 5 ] 5 | then 6 | 7 | deb="$1" 8 | program="$2" 9 | desktop_entry="$3" 10 | icon="$4" 11 | out="$5" 12 | 13 | mkdir -p ~/.shradiko 14 | cd ~/.shradiko 15 | rm -rf AppImage 16 | rm ubuntu-base-20.04.1-base-amd64.tar.gz 17 | wget https://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.1-base-amd64.tar.gz 18 | mkdir -p AppImage/root 19 | cd AppImage/root 20 | tar -xf ../../ubuntu-base-20.04.1-base-amd64.tar.gz 21 | cd ../.. 22 | cp "$deb" AppImage/root/root/package.deb 23 | cp "$(dirname "$(realpath "$0")")/shradiko-apt-install" AppImage/root/root 24 | mount --bind /dev AppImage/root/dev 25 | mount -t proc chroot-proc AppImage/root/proc 26 | mount --bind /tmp AppImage/root/tmp 27 | chroot AppImage/root /root/shradiko-apt-install 28 | umount AppImage/root/dev 29 | umount AppImage/root/proc 30 | umount AppImage/root/tmp 31 | rm -rf AppImage/root/boot 32 | rm -rf AppImage/root/dev 33 | rm -r AppImage/root/home 34 | rm -r AppImage/root/media 35 | rm -r AppImage/root/mnt 36 | rm -r AppImage/root/proc 37 | rm -r AppImage/root/root 38 | rm -r AppImage/root/run 39 | rm -r AppImage/root/srv 40 | rm -r AppImage/root/sys 41 | rm -r AppImage/root/tmp 42 | cp "$(dirname "$(realpath "$0")")/AppRun" AppImage 43 | sed "s/PROGRAM/$program/" "$(dirname "$(realpath "$0")")/shradiko" > AppImage/shradiko 44 | chmod +x AppImage/shradiko 45 | cp "$desktop_entry" AppImage 46 | cp "$icon" AppImage 47 | appimagetool AppImage "$out" 48 | 49 | else 50 | echo "Usage: shradiko-apt DEB_FILE PROGRAM DESKTOP_ENTRY ICON_FILE OUT" 51 | fi -------------------------------------------------------------------------------- /usr/lib/shradiko/shradiko-apt-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo 'nameserver 8.8.8.8' > /etc/resolv.conf 3 | unset PYTHONPATH 4 | unset PYTHONHOME 5 | export DEBIAN_FRONTEND=noninteractive 6 | apt update 7 | apt install -y ~/package.deb -------------------------------------------------------------------------------- /usr/share/applications/shradiko.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Shradiko APT 4 | Icon=shradiko 5 | Categories=Utility; 6 | Exec=shradiko-apt 7 | Terminal=false -------------------------------------------------------------------------------- /usr/share/icons/hicolor/scalable/apps/shradiko.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------