aboutsummaryrefslogtreecommitdiff
path: root/al.getcryst.crystal/crystal.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--al.getcryst.crystal/crystal.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/al.getcryst.crystal/crystal.sh b/al.getcryst.crystal/crystal.sh
new file mode 100644
index 0000000..39926c3
--- /dev/null
+++ b/al.getcryst.crystal/crystal.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+mkdir -p ~/.var/app/al.getcryst.crystal/rootfs
+DESTDIR=$(realpath ~/.var/app/al.getcryst.crystal/rootfs)
+if [[ ! -f ${DESTDIR}/etc/os-release ]]; then
+ rm -rf ${DESTDIR} || true
+ mkdir -p ${DESTDIR}/{dev,sys,proc}
+ cd ${DESTDIR}
+ tar --exclude dev --exclude sys --exclude proc -xf /app/crystal.tar.gz
+ chown ${USER} -R ${DESTDIR}/root.x86_64
+ chmod 755 -R ${DESTDIR}/root.x86_64
+ mv ${DESTDIR}/root.x86_64/* ${DESTDIR}
+ rm -rf ${DESTDIR}root.x86_64
+ cat /etc/resolv.conf > ${DESTDIR}/etc/resolv.conf
+ echo "crystal" > ${DESTDIR}/etc/hostname
+fi
+if [[ $1 == "" ]]; then
+ cmd="/bin/bash"
+fi
+exec env -i /app/bin/proot -r ${DESTDIR}/ -w / -0 -b /dev -b /sys -b /proc -b /run /bin/sh -c "
+ export PULSE_SERVER=127.0.0.1
+ export USER=root
+ . /etc/profile
+ exec $cmd $@"