#!/bin/execlineb -P

/bin/export PATH "/home/ccx/bin:/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
/bin/cd /
s6-setsid -qb --
umask 022

if { s6-echo -n -- "\n* user container init: " }
foreground { uname -n }

s6-envdir -I -- "/home/ccx/run/"/env

if { s6-echo -- "\n* current environment: " }
if { env }

if { s6-echo -- "\n* checking X11 availability: " }
if { importas -i HOST HOST stat /tmp/.X11-unix/${HOST} }
if { xprop -root }

if { s6-echo -- "\n* OK, starting up services: " }
redirfd -r 0 /dev/null
background
{
  s6-setsid --
  fdmove -c 2 1
  /home/ccx/run/rc.init
}
unexport !
cd /run/service
fdmove -c 2 1
fdclose 3  # notification-fd
emptyenv -c
s6-svscan -t 0