4 # Test an AppDir or AppImage on a given ISO or squashfs base system
10 HERE
=$
(dirname $
(readlink
-f "${0}"))
11 export PATH
=$HERE:$PATH
13 if [ "$1x" == "x" ] ; then
14 echo "Please specify a ISO or squashfs base system to run the AppImage on"
18 if [ "$2x" == "x" ] ; then
19 echo "Please specify an AppDir or AppImage to be run"
23 mkdir
-p /tmp
/unionfs
/root
24 mkdir
-p /tmp
/unionfs
/rw
28 # If ISO was specified, then mount it and find contained filesystem
30 if [ ${1: -4} == ".iso" ] ; then
32 mount
-o loop
,ro
"$ISO" /tmp
/iso
35 # In case of Ubuntu-like ISOs
36 if [ -e /tmp
/iso
/casper
/filesystem.squashfs
] ; then
37 THEFS
=/tmp
/iso
/casper
/filesystem.squashfs
38 mount
"$THEFS" /tmp
/unionfs
/root
-o loop
,ro ||
exit 1
41 # In case of Fedora-like ISOs
42 if [ -e /tmp
/iso
/LiveOS
/squashfs.img
] ; then
43 mount
-o loop
,ro
/tmp
/iso
/LiveOS
/squashfs.img
/tmp
/iso
/
44 THEFS
=/tmp
/iso
/LiveOS
/ext3fs.img ||
exit 1
45 mount
"$THEFS" /tmp
/unionfs
/root
-o loop
,ro ||
exit 1
52 umount
-l /tmp
/union
/var
/lib
/dbus
2>/dev
/null
53 umount
-l /tmp
/union
/etc
/resolv.conf
2>/dev
/null
54 umount
-l /tmp
/union
/proc
2>/dev
/null
55 umount
-l /tmp
/union
/boot
2>/dev
/null
56 # umount -l /tmp/union/automake 2>/dev/null # Puppy
57 umount
-l /tmp
/union
2>/dev
/null
58 umount
-l /tmp
/unionfs
/root
2>/dev
/null
59 umount
-l /tmp
/iso
2>/dev
/null
60 umount
-l /tmp
/iso
2>/dev
/null
61 umount
-l /tmp
/iso
2>/dev
/null
62 sudo killall unionfs-fuse
63 rm -r /tmp
/unionfs
/root
71 unionfs-fuse
-o allow_other
,use_ino
,suid
,dev
,nonempty
-ocow,chroot
=/tmp
/unionfs
/,max_files
=32768 /rw
=RW
:/root
=RO
/tmp
/union
73 ls /tmp
/union
/boot
>/dev
/null
&& MNT
=/boot
74 # ls /tmp/union/automake >/dev/null && MNT=/automake || echo "" # Puppy
76 if [ "x$MNT" == "x" ] ; then
77 echo "Could not find free mountpoint"
82 mount
"$2" /tmp
/union
/$MNT -o loop
83 elif [ -d "$2" ] ; then
84 mount
"$2" /tmp
/union
/$MNT -o bind
87 cat > /tmp
/union
/run.sh
<<EOF
93 pango-querymodules > '/etc/pango/pango.modules' # otherwise only squares instead of text
94 [ -f /si-chroot ] && ln -s /lib/ld-lsb.so.3 /lib/ld-linux.so.2
96 echo "===================================================="
98 LD_LIBRARY_PATH=$MNT/usr/lib:$MNT/lib/:$LD_LIBRARY_PATH ldd $MNT/usr/bin/* $MNT/usr/lib/* 2>/dev/null | grep "not found" | sort | uniq
100 echo "===================================================="
103 export LANG="en_EN.UTF-8"
104 # export QT_PLUGIN_PATH=./lib/qt4/plugins ###################### !!!
105 dbus-launch $MNT/AppRun || $MNT/AppRun
107 chmod a
+x
/tmp
/union
/run.sh
108 mount
-t proc proc
/tmp
/union
/proc
109 mount
--bind /var
/lib
/dbus
/tmp
/union
/var
/lib
/dbus
110 touch /tmp
/union
/etc
/resolv.conf ||
echo ""
111 mount
--bind /etc
/resolv.conf
/tmp
/union
/etc
/resolv.conf
112 xhost
local: # otherwise "cannot open display: :0.0"
114 echo "===================================================="
116 chroot
/tmp
/union
/ /run.sh
# $MNT/AppRun
118 echo "===================================================="