From 53a69e0611e858e99ecefc3224c18a09d911d514 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 26 Feb 2023 17:51:47 -0300 Subject: git mv bin/upgrade bin/reconfigure --- bin/reconfigure | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/upgrade | 82 --------------------------------------------------------- 2 files changed, 82 insertions(+), 82 deletions(-) create mode 100755 bin/reconfigure delete mode 100755 bin/upgrade (limited to 'bin') diff --git a/bin/reconfigure b/bin/reconfigure new file mode 100755 index 0000000..70911ba --- /dev/null +++ b/bin/reconfigure @@ -0,0 +1,82 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + reconfigure + reconfigure -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -h, --help show this message + + + Switches the system: + - reconfigure the Guix "home" environment; + - Guix "system" if it exists; + - NixOS if it exists. + + + Examples: + + Just use it: + + $ reconfigure + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +while getopts 'h' flag; do + case "$flag" in + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +HOSTNAME="$(hostname)" + +if [ -e /run/current-system/configuration.scm ]; then + pass show "$(hostname)"/andreh | + head -n1 | + sudo -ES guix system -v3 reconfigure /run/current-system/configuration.scm +fi + +TWO_HOURS='7200' + +timeout "$TWO_HOURS" \ + guix home -v3 reconfigure ~/.guix-home/configuration.scm + +if [ -e /etc/nixos/configuration.nix ]; then + pass show "$HOSTNAME"/andreh | + head -n1 | + sudo -S nixos-rebuild switch --upgrade +fi diff --git a/bin/upgrade b/bin/upgrade deleted file mode 100755 index 298ac31..0000000 --- a/bin/upgrade +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -set -eu - -usage() { - cat <<-'EOF' - Usage: - upgrade - upgrade -h - EOF -} - -help() { - cat <<-'EOF' - - Options: - -h, --help show this message - - - Upgrades the system: - - reconfigure the Guix "home" environment; - - Guix "system" if it exists; - - NixOS if it exists. - - - Examples: - - Just use it: - - $ upgrade - EOF -} - - -for flag in "$@"; do - case "$flag" in - --) - break - ;; - --help) - usage - help - exit - ;; - *) - ;; - esac -done - -while getopts 'h' flag; do - case "$flag" in - h) - usage - help - exit - ;; - *) - usage >&2 - exit 2 - ;; - esac -done -shift $((OPTIND - 1)) - - -HOSTNAME="$(hostname)" - -if [ -e /run/current-system/configuration.scm ]; then - pass show "$(hostname)"/andreh | - head -n1 | - sudo -ES guix system -v3 reconfigure /run/current-system/configuration.scm -fi - -TWO_HOURS='7200' - -timeout "$TWO_HOURS" \ - guix home -v3 reconfigure ~/.guix-home/configuration.scm - -if [ -e /etc/nixos/configuration.nix ]; then - pass show "$HOSTNAME"/andreh | - head -n1 | - sudo -S nixos-rebuild switch --upgrade -fi -- cgit v1.2.3