This commit is contained in:
Maxim Slipenko 2023-11-19 22:26:09 +03:00
parent 6063360ded
commit 3a2ff7018a
3 changed files with 13 additions and 9 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
iso/*.iso
iso/*.iso
package.box

View File

@ -10,9 +10,10 @@
("/pkg-install" action "write" lists "" auto #t)
("/preinstall" action "write")
("/grub" action "write" device "/dev/vda" passwd #f passwd_1 "*" passwd_2 "*")
; настройка сетевого интерфейса на получение адреса по DHCP
("/net-eth" action "write" reset #t)
("/net-eth" action "write" name "eth0" configuration "dhcp")
("/net-eth" action "write" name "ens5" ipv "4" configuration "dhcp" default "" search "" dns "" computer_name "newhost" ipv_enabled #t)
("/net-eth" action "write" commit #t)
("/root/change_password" language ("en_US") passwd_2 "vagrant" passwd_1 "vagrant")
("/users/create_account" new_name "vagrant" gecos "vagrant" allow_su #t auto #f passwd_1 "vagrant" passwd_2 "vagrant" autologin #f)
("/postinstall/laststate" script "http://server/script.sh")
("/postinstall/laststate" script "https://raw.githubusercontent.com/Maks1mS/alt-linux-vagrant-boxes/main/alt-server-v-10/setup.sh")

View File

@ -1,11 +1,13 @@
#!/bin/bash -e
a= . install2-init-functions
# add vagrant's public key - user can ssh without password
mkdir -pm 700 /home/vagrant/.ssh
curl -q -o /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
run_chroot mkdir -pm 700 /home/vagrant/.ssh
run_chroot curl -q -o /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
run_chroot chmod 0600 /home/vagrant/.ssh/authorized_keys
run_chroot chown -R vagrant:vagrant /home/vagrant/.ssh
# give sudo access (grants all permissions to user vagrant)
echo "vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
run_chroot echo "vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
run_chroot chmod 0440 /etc/sudoers.d/vagrant