registry/scripts/testbed_deploy.sh
U-DESKTOP-Q82J13B\wxz 01bc3762b2 wxz-zgc-pc (#86)
Reviewed-on: NASP/registry#86
Reviewed-by: ryanyu <ryy23@mails.tsinghua.edu.cn>
Co-authored-by: U-DESKTOP-Q82J13B\wxz <wang-xz22@mails.tsinghua.edu.cn>
Co-committed-by: U-DESKTOP-Q82J13B\wxz <wang-xz22@mails.tsinghua.edu.cn>
2024-10-10 09:47:43 +08:00

21 lines
491 B
Bash
Executable File

#!/bin/bash
set -ex
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
apt update && apt install sudo
addgroup nasp
insert_if_not_exist()
{
filename=$1
line=$2
if [ ! -f "$filename" ]; then
touch $filename
fi
grep -qxF -- "$line" "$filename" || echo "$line" >> "$filename"
}
insert_if_not_exist "/etc/crontab" "*/5 * * * * root cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/testbed_cron.sh"
"$THIS_DIR"/testbed_cron.sh