fix(testbed/cron): support nixos

This commit is contained in:
Dict Xiong 2024-05-29 17:31:05 +08:00
parent aec64a8d54
commit 937bf9e000

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -ex set -ex
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
@ -46,7 +46,10 @@ update_key() {
} }
main() { main() {
cp "$THIS_DIR/nasp" "/etc/sudoers.d/nasp" if [ -f /etc/os-release ]; then
. /etc/os-release
test "$ID" = "nixos" || cp "$THIS_DIR/nasp" "/etc/sudoers.d/nasp"
fi
for file in "$THIS_DIR"/../authorized_keys/* ; do for file in "$THIS_DIR"/../authorized_keys/* ; do
if [[ ! -d "$file" ]]; then if [[ ! -d "$file" ]]; then
continue continue