diff --git a/gale-install.in b/gale-install.in index 50e8ad8..eec0ed2 100644 --- a/gale-install.in +++ b/gale-install.in @@ -29,22 +29,78 @@ testkey_stdin() { gkinfo -x 2>/dev/null | qgrep "^Public key: <$1>" } -if [ -n "$GALE_SYS_DIR" ]; then - SYS_DIR="$GALE_SYS_DIR" -elif [ -n "$sysconfdir" ]; then - SYS_DIR="$sysconfdir/gale" +INST_SYS_DIR="$sysconfdir/gale" + +if [ `id -u` -eq 0 ]; then + is_root=yes + SYS_DIR=/etc/gale +else + is_root=no + SYS_DIR="$HOME/.gale" +fi + +if [ -f /etc/NIXOS ]; then + is_nixos=yes +else + is_nixos=no +fi + +if [ -u /run/wrappers/bin/gksign ]; then + cat < "$CONF" <> "$CONF" <> "$CONF" << EOM + cat > "$CONF" </dev/null`" -[ -f "$gksignlink" ] && gksign="$gksignlink" - -echo "" -if copy chown "$GALE_USER" "$gksign" ; then - : -else - echo "*** We need to chown $GALE_USER '$gksign'." - echo " Please run this script as a user that can do so," - echo " or do so yourself and re-run this script." - exit 1 + fi fi -run chmod 4755 "$gksign" -# ----------------------------------------------------------------------------- -# create a domain, if necessary +if [ $is_root = no ]; then + GALE_SYS_DIR="$SYS_DIR" + export GALE_SYS_DIR -echo "" -if test -u "$gksign" || copy chmod u+s "$gksign" ; then - : + testkey "$GALE_DOMAIN" && exit 0 + echo "*** You lack a signed key for your domain, \"$GALE_DOMAIN\"." + GALE="$SYS_DIR" else - echo "*** We need to chmod u+s '$gksign'." - echo " Please run this script as a user that can do so," - echo " or do so yourself and re-run this script." - exit 1 -fi - -testkey "$GALE_DOMAIN" && exit 0 -echo "*** You lack a signed key for your domain, \"$GALE_DOMAIN\"." - -if [ "x$GALE_USER" != "x$USER" ]; then -cat <