From 683dbc85fc5a7236af39d4e84d69b94c90f2d8d5 Mon Sep 17 00:00:00 2001 From: idk Date: Fri, 3 Dec 2021 23:56:32 -0500 Subject: [PATCH] Add a postinstall script --- .gitignore | 1 + Makefile | 1 + postinstall-pak | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100755 postinstall-pak diff --git a/.gitignore b/.gitignore index 6c14aa6..b01e44e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ i2p-tools-* *.crt *.pem plugin +reseed-tools* \ No newline at end of file diff --git a/Makefile b/Makefile index 364f076..50ddfdb 100644 --- a/Makefile +++ b/Makefile @@ -231,6 +231,7 @@ tmp/content: su3s: tmp/content i2p.plugin.native -name=reseed-tools-$(GOOS)-$(GOARCH) \ + -displayname="Reseed Tools" \ -signer=hankhill19580@gmail.com \ -version "$(VERSION)" \ -author=hankhill19580@gmail.com \ diff --git a/postinstall-pak b/postinstall-pak new file mode 100755 index 0000000..57c9f7c --- /dev/null +++ b/postinstall-pak @@ -0,0 +1,35 @@ +#! /usr/bin/env sh +RESEED_MESSAGE="Reseed Tools requires you to set an email for contact purposes. +This is in case your reseed goes down. +Please enter your email below." + +RESEED_CONF="# Use this file to configure the contact/signer email used for the reseed service. +# without it the reseed will fail to start. + +[Service] +Environment=\"RESEED_EMAIL=" + +RESEED_DEFAULT="#Edit the contact/signing email used by your reseed server here +export RESEED_EMAIL=\"" + +mkdir -p /etc/systemd/system/reseed.d/ + +if [ -f /usr/bin/zenity ]; then + RESEED_EMAIL=$(zenity --entry --title "Reseed Configuration" --text "$RESEED_MESSAGE" 10 30 3>&1 1>&2 2>&3) + echo "$RESEED_DEFAULT$RESEED_EMAIL\"" >> /etc/default/reseed + echo "$RESEED_CONF$RESEED_EMAIL\"" >> /etc/systemd/system/reseed.d/reseed.conf + exit 0 +fi + +if [ -t 1 ] ; then + echo "proceeding with terminal"; +else + exit 0 +fi + +if [ -f /usr/bin/whiptail ]; then + RESEED_EMAIL=$(whiptail --inputbox "$RESEED_MESSAGE" 10 30 3>&1 1>&2 2>&3) + echo "$RESEED_DEFAULT$RESEED_EMAIL\"" >> /etc/default/reseed + echo "$RESEED_CONF$RESEED_EMAIL\"" >> /etc/systemd/system/reseed.d/reseed.conf + exit 0 +fi