[Unit]
Description=End-user configuration after initial OEM installation
ConditionFileIsExecutable=/usr/sbin/oem-config-firstboot
ConditionPathExists=/dev/tty1

# We never want to run the oem-config job in the live environment (as is the
# case in some custom configurations) or in recovery mode.
ConditionKernelCommandLine=!boot=casper
ConditionKernelCommandLine=!single
ConditionKernelCommandLine=!rescue
ConditionKernelCommandLine=!emergency

[Service]
Type=oneshot
StandardInput=tty
StandardOutput=tty
StandardError=tty
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
ExecStart=/bin/sh -ec '\
    for x in $(cat /proc/cmdline); do				\
	case $x in						\
	    debug-oem-config) debug=--debug ;;			\
	    ubiquity/frontend=*) export frontend="${x#*=}" ;;	\
	    automatic-oem-config) automatic=--automatic ;;	\
	esac;							\
    done;							\
    exec oem-config-firstboot $debug $automatic'

[Install]
WantedBy=oem-config.target
