provision.pl added repo clone command

This commit is contained in:
gashapwn 2020-11-28 21:51:19 +00:00
parent f3021964de
commit fa7205481b

View File

@ -12,10 +12,13 @@ use strict;
# gashapwn # gashapwn
# Nov 2020 # Nov 2020
my $GIT_REPO = 'https://git.lain.church/gashapwn/lyadmin.git';
my $pwuid; my $pwuid;
my $admin_un; my $admin_un;
my $admin_home_dir;
# Make sure we're running as root # Make sure we're running as root
$pwuid = getpwuid( $< ); $pwuid = getpwuid( $< );
@ -32,5 +35,13 @@ if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:\n]+):[^:]+:[0-
die "create a non-root user & set user passsword before running this script." die "create a non-root user & set user passsword before running this script."
} }
$admin_home_dir = "/home/$admin_un";
# grant doas access to admin user # grant doas access to admin user
system("echo 'permit $admin_un' > /etc/doas.conf"); system("echo 'permit $admin_un' > /etc/doas.conf");
# install git
system("pkg_add git");
chdir $admin_home_dir;
system("su gashapwn -c 'git clone $GIT_REPO'");