git.delta.rocks / jrsonnet / refs/commits / 1b17cca8d34d

difftreelog

source

scripts/install-trusted-cert.sh758 Bsourcehistory
1#!/bin/sh23set -eu45pubkey="$(sudo cat /etc/nix/private-key | nix key convert-secret-to-public)"6echo pubkey = "$pubkey"78edited_conf=$(mktemp)910remote_conf=$(ssh "$1" cat /etc/nix/nix.conf)11echo remote_conf = \"\"\"12echo "$remote_conf"13echo \"\"\"14echo "$remote_conf" >"$edited_conf"15sed -i 's/\.  Do not edit it!/\. Then it was altered by install-trusted-cert. Do not edit!/g' "$edited_conf"16sed -i "s|^trusted-public-keys =.*|& $pubkey|g" "$edited_conf"1718echo edited_conf = \"\"\"19cat "$edited_conf"20echo \"\"\"2122# Make nix.conf editable23ssh "$1" sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.bk24ssh "$1" sudo cp /etc/nix/nix.conf.bk /etc/nix/nix.conf25ssh "$1" "cat | sudo dd of=/etc/nix/nix.conf" <"$edited_conf"26ssh "$1" sudo systemctl restart nix-daemon