11#!/bin/false
22
3+ _run_outside_fuse() {
4+ _rundir=${XDG_CACHE_HOME:-$HOME/.cache}/waydroid-AppImage
5+ mkdir -p "$_rundir"/bin
6+
7+ ln -sfn "$APPDIR"/bin/data "$_rundir"/bin
8+ ln -sfn "$APPDIR"/bin/tools "$_rundir"/bin
9+
10+ cp "$APPDIR"/bin/waydroid* "$_rundir"/bin
11+
12+ cp "$APPDIR"/sharun "$_rundir"
13+ cp "$APPDIR"/.env "$_rundir" 2>/dev/null || :
14+ cp "$APPDIR"/.preload "$_rundir" 2>/dev/null || :
15+
16+ for pybin in "$APPDIR"/bin/python*; do
17+ case "$pybin" in
18+ *config)
19+ : # skip python config scripts
20+ ;;
21+ *)
22+ [ -f "$pybin" ] || continue
23+ ln -f "$_rundir"/sharun "$_rundir"/bin/"${pybin##*/}"
24+ ;;
25+ esac
26+ done
27+
28+ ln -sfn "$APPDIR"/lib "$_rundir"/lib
29+ ln -sfn "$APPDIR"/share "$_rundir"/share
30+ ln -sfn "$APPDIR"/shared "$_rundir"/shared
31+ ln -sfn "$APPDIR"/etc "$_rundir"/etc 2>/dev/null || :
32+
33+ PATH=$_rundir/bin:$PATH
34+ # override APPDIR now so that the AppRun launches the right binaries
35+ APPDIR=$_rundir
36+
37+ export PATH APPDIR
38+ }
39+
340_is_cmd() {
441 for cmd do
542 command -v "$cmd" 1>/dev/null || return 1
@@ -32,12 +69,7 @@ _install_polkit_policy() (
3269 dbus_src2="$APPDIR"/share/dbus-1/system.d/id.waydro.Container.conf
3370 dbus_dst2=/usr/share/dbus-1/system.d/id.waydro.Container.conf
3471
35- # for some reason we get permission denied error if we try to copy
36- # directly to the destination, so instead we have to fisrt copy to
37- # XDG_CACHE_HOME and then to the destination lol
38- tmpdir="${XDG_CACHE_HOME:-$HOME/.cache}"/temp-polkit
39-
40- if [ ! -f "$rule_dst" ] || [ ! -f "$dbus_dst2" ]; then
72+ if [ ! -f "$rule_dst" ] || [ ! -f "$dbus_dst1" ] || [ ! -f "$dbus_dst2" ]; then
4173 zenity --width=555 --question --text "$(cat <<-EOF
4274 We need to install a few dbus and polkit files for this application to work
4375 Normally we would place them in /usr/local/share, but for some reason it doesn't work
@@ -52,20 +84,13 @@ _install_polkit_policy() (
5284 In that case you will have to remove those files manually!
5385 EOF
5486 )" || return 1
55-
56- # remove anything funny that could be there
57- rm -rf "$tmpdir"
58- mkdir -p "$tmpdir"
59- cp -v "$rule_src" "$tmpdir"
60- cp -v "$dbus_src1" "$tmpdir"
61- cp -v "$dbus_src2" "$tmpdir"
6287 $sudocmd /bin/sh -c "
6388 mkdir -p /usr/share/polkit-1/actions
6489 mkdir -p /usr/share/dbus-1/system-services
6590 mkdir -p /usr/share/dbus-1/system.d
66- cp -v \"$tmpdir\"/id.waydro.Container.policy \"$rule_dst\"
67- cp -v \"$tmpdir\"/id.waydro.Container.service \"$dbus_dst1\"
68- cp -v \"$tmpdir\"/id.waydro.Container.conf \"$dbus_dst2\"
91+ cp -v \"$rule_src\" \"$rule_dst\"
92+ cp -v \"$dbus_src1\" \"$dbus_dst1\"
93+ cp -v \"$dbus_src2\" \"$dbus_dst2\"
6994 "
7095 fi
7196)
@@ -131,11 +156,11 @@ elif [ "$(id -u)" = 0 ]; then
131156 sudocmd=""
132157else
133158 zenity --error --text "We need 'pkexec' or 'lxqt-sudo' to setup Waydroid"
134- zenity --info --text "You can also try to run the AppImage as root"
135159 exit 1
136160fi
137161
138162_check_kernel
163+ _run_outside_fuse
139164_install_polkit_policy || :
140165_start_12to11
141166
0 commit comments