all_off="$(tput sgr0)" bold="${all_off}$(tput bold)" blue="${bold}$(tput setaf 4)" yellow="${bold}$(tput setaf 3)" noteb() { printf "${blue} ->${yellow} ${bold}$1${all_off}\n" } note() { printf "${blue} ->${yellow} $1${all_off}\n" } post_install() { sysctl -q --system systemctl --quiet daemon-reload useradd -r -U -s /usr/bin/nologin -m -d /var/lib/wireguard-ui wireguard-ui [ ! -f "/etc/wireguard/wg0.conf" ] && { mkdir -p /etc/wireguard/; touch /etc/wireguard/wg0.conf; } setfacl -m wireguard-ui:rw /etc/wireguard/wg0.conf echo noteb "Please start and enable service:" echo "sudo systemctl enable --now wireguard-ui" echo note "Then open in browser http://:5000" noteb "The default username and password are 'admin'. Please change it to secure your setup!" echo noteb "REQUIRED: Also specify in server settings PostUp and PostDown scripts:" echo "PostUp: '/usr/bin/wgiptables up'" echo "PostDown: '/usr/bin/wgiptables down'" echo noteb "Then save server settings and finally start wg server:" echo "sudo systemctl enable --now wgui.{service,path}" echo noteb "Optional: Also you could create /etc/wireguard-ui/environment.conf file." echo "More info: https://github.com/ngoduykhanh/wireguard-ui#environment-variables" echo } post_upgrade() { sysctl -q --system systemctl --quiet daemon-reload } pre_remove() { systemctl --quiet --no-reload disable --now wireguard-ui.service systemctl --quiet --no-reload disable --now wgui.path systemctl --quiet --no-reload disable --now wgui.service } post_remove() { note "Old settings are located in /var/lib/wireguard-ui/db, skip removing." systemctl --quiet daemon-reload sysctl -q --system }