#!/bin/bash set -e do_init_regen() { if [[ $EUID -ne 0 ]]; then echo "You must be root to run this script" 1>&2 exit 1 fi cd /usr/share/yunohost/templates/yunohost [[ -d /etc/yunohost ]] || mkdir -p /etc/yunohost # set default current_host [[ -f /etc/yunohost/current_host ]] \ || echo "yunohost.org" > /etc/yunohost/current_host # copy default firewall and services # TODO: update them as needed with upgrades [[ -f /etc/yunohost/firewall.yml ]] \ || cp firewall.yml /etc/yunohost/firewall.yml [[ -f /etc/yunohost/services.yml ]] \ || cp services.yml /etc/yunohost/services.yml # allow users to access /media directory [[ -d /etc/skel/media ]] \ || (mkdir -p /media && ln -s /media /etc/skel/media) } FORCE=$2 case "$1" in pre|post) ;; init) do_init_regen ;; *) echo "hook called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0