#!/bin/bash set -e ensure_dir() { local install_dir="$1" if ! test -d "$install_dir"; then echo "Error: $install_dir isn't there" exit 1 fi } install_default() { local install_dir="/etc/default" ensure_dir $install_dir cat >"$install_dir/cml-autostart" <"$install_dir/cml-autostart.sh" <"$install_dir/cml-autostart.service" </dev/null enable cml-autostart.service } if [[ $EUID -ne 0 ]]; then echo "This script must be run as root." >&2 exit 1 fi echo -n "installing defaults" install_default echo -e "\t✅" echo -n "installing script" install_script echo -e "\t✅" echo -n "installing service unit" install_service_unit echo -e "\t✅" cat <