testing
This commit is contained in:
parent
1ef4257c0a
commit
324a629be1
1 changed files with 81 additions and 80 deletions
161
msg/machine.scm
161
msg/machine.scm
|
@ -31,12 +31,12 @@
|
|||
(match args
|
||||
(("-h")
|
||||
(help))
|
||||
;; (("init" rest ...)
|
||||
;; (init rest))
|
||||
;; (("reinit")
|
||||
;; (stop)
|
||||
;; (clear-install)
|
||||
;; (init))
|
||||
(("init" rest ...)
|
||||
(init rest))
|
||||
(("reinit")
|
||||
(stop)
|
||||
(clear-install)
|
||||
(init))
|
||||
(("start" rest ...)
|
||||
(start rest))
|
||||
(("stop")
|
||||
|
@ -107,90 +107,91 @@
|
|||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo shutdown'"))
|
||||
|
||||
|
||||
;; (define* (init #:optional args)
|
||||
(define* (init #:optional args)
|
||||
|
||||
;; (if (not (directory-exists? (format #f "~a/.guix" home-path)))
|
||||
;; (begin
|
||||
;; ;; Grab ssh cert for installer
|
||||
;; (system "mkdir -p $HOME/.guix/qemu $HOME/.guix/home $HOME/.guix/ssh-cert")
|
||||
;; (system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
;; ;; Download system image and and start vm
|
||||
;; (cond
|
||||
;; ((string=? arch "arm64")
|
||||
;; (system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-aarch64guix-installer.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||
;; (system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||
;; (system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-aarch64config.scm -O $HOME/.guix/home/config.scm")
|
||||
;; ;; Get msg ssh-key
|
||||
;; (system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg_rsa -O $HOME/.guix/ssh-cert/msg_rsa")
|
||||
;; (system "chmod 400 ~/.guix/ssh-cert/msg_rsa ")
|
||||
;; (system "/opt/homebrew/bin/qemu-system-aarch64 \
|
||||
;; -machine virt,highmem=on \
|
||||
;; -accel hvf \
|
||||
;; -cpu host \
|
||||
;; -smp 4 \
|
||||
;; -display none \
|
||||
;; -hda $HOME/.guix/qemu/guix-user.qcow2 \
|
||||
;; -m 4G \
|
||||
;; -virtfs local,path=$HOME/.guix/home,security_model=mapped,mount_tag=macos \
|
||||
;; -bios /opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd \
|
||||
;; -device virtio-net,netdev=vmnic \
|
||||
;; -netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22 &")
|
||||
;; (sleep 5)
|
||||
;; (update-uid)
|
||||
(if (not (directory-exists? (format #f "~a/.guix" home-path)))
|
||||
(begin
|
||||
;; Grab ssh cert for installer
|
||||
(system "mkdir -p $HOME/.guix/qemu $HOME/.guix/home $HOME/.guix/ssh-cert")
|
||||
(system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
;; Download system image and and start vm
|
||||
(cond
|
||||
((string=? arch "arm64")
|
||||
(system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-aarch64guix-installer.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||
(system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||
(system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-aarch64config.scm -O $HOME/.guix/home/config.scm")
|
||||
;; Get msg ssh-key
|
||||
(system "/opt/homebrew/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg_rsa -O $HOME/.guix/ssh-cert/msg_rsa")
|
||||
(system "chmod 400 ~/.guix/ssh-cert/msg_rsa ")
|
||||
(system "/opt/homebrew/bin/qemu-system-aarch64 \
|
||||
-machine virt,highmem=on \
|
||||
-accel hvf \
|
||||
-cpu host \
|
||||
-smp 4 \
|
||||
-display none \
|
||||
-hda $HOME/.guix/qemu/guix-user.qcow2 \
|
||||
-m 4G \
|
||||
-virtfs local,path=$HOME/.guix/home,security_model=mapped,mount_tag=macos \
|
||||
-bios /opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd \
|
||||
-device virtio-net,netdev=vmnic \
|
||||
-netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22 &")
|
||||
(sleep 5)
|
||||
(update-uid)
|
||||
|
||||
;; (build-msg)
|
||||
(build-msg)
|
||||
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'shutdown'")
|
||||
;; (system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
;; (sleep 30)
|
||||
;; (system "rm ~/.guix/qemu/guix-user.qcow2")
|
||||
;; (system "mv ~/.guix/home/guix-user.qcow2 ~/.guix/qemu/")
|
||||
;; (start)
|
||||
;; (sleep 15)
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mkdir /Users /boot/efi'")
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mount /dev/vda1 /boot/efi'"))
|
||||
;; ((string=? arch "x86_64")
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-x86_64guix-installer.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||
;; (system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-x86_64config.scm -O $HOME/.guix/home/config.scm")
|
||||
;; ;; Get msg ssh-key
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg_rsa -O $HOME/.guix/ssh-cert/msg_rsa")
|
||||
;; (system "chmod 400 ~/.guix/ssh-cert/msg_rsa ")
|
||||
;; (system "/usr/local/bin/qemu-system-x86_64 \
|
||||
;; -machine type=q35,accel=hvf \
|
||||
;; -smp 4 \
|
||||
;; -hda $HOME/.guix/qemu/guix-installer.qcow2 \
|
||||
;; -m 4G \
|
||||
;; -display none \
|
||||
;; -cpu Nehalem \
|
||||
;; -virtfs local,path=$HOME/.guix/home,security_model=mapped,mount_tag=macos \
|
||||
;; -device virtio-net,netdev=vmnic \
|
||||
;; -netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22 &")
|
||||
;; (sleep 5)
|
||||
;; (update-uid)
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'shutdown'")
|
||||
(system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
(sleep 30)
|
||||
(system "rm ~/.guix/qemu/guix-user.qcow2")
|
||||
(system "mv ~/.guix/home/guix-user.qcow2 ~/.guix/qemu/")
|
||||
(start)
|
||||
(sleep 15)
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mkdir /Users /boot/efi'")
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mount /dev/vda1 /boot/efi'"))
|
||||
;; ((string=? arch "x86_64")
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-x86_64guix-installer.qcow2.tar.gz -O $HOME/.guix/qemu/guix.qcow2.tar.gz")
|
||||
;; (system "tar -xvzf $HOME/.guix/qemu/guix.qcow2.tar.gz -C $HOME/.guix/qemu/")
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg-system-x86_64config.scm -O $HOME/.guix/home/config.scm")
|
||||
;; ;; Get msg ssh-key
|
||||
;; (system "/usr/local/bin/wget https://objectstorage.us-phoenix-1.oraclecloud.com/n/axfgkze2xif1/b/guix-system/o/msg_rsa -O $HOME/.guix/ssh-cert/msg_rsa")
|
||||
;; (system "chmod 400 ~/.guix/ssh-cert/msg_rsa ")
|
||||
;; (system "/usr/local/bin/qemu-system-x86_64 \
|
||||
;; -machine type=q35,accel=hvf \
|
||||
;; -smp 4 \
|
||||
;; -hda $HOME/.guix/qemu/guix-installer.qcow2 \
|
||||
;; -m 4G \
|
||||
;; -display none \
|
||||
;; -cpu Nehalem \
|
||||
;; -virtfs local,path=$HOME/.guix/home,security_model=mapped,mount_tag=macos \
|
||||
;; -device virtio-net,netdev=vmnic \
|
||||
;; -netdev user,id=vmnic,hostfwd=tcp:127.0.0.1:9001-:22 &")
|
||||
;; (sleep 5)
|
||||
;; (update-uid)
|
||||
|
||||
;; (build-msg)
|
||||
;; (build-msg)
|
||||
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'shutdown'")
|
||||
;; (system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
;; (sleep 30)
|
||||
;; (system "rm ~/.guix/qemu/guix-installer.qcow2")
|
||||
;; (system "mv ~/.guix/home/guix-user.qcow2 ~/.guix/qemu/")
|
||||
;; (start)
|
||||
;; (sleep 15)
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mkdir /Users'")))
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa root@127.0.0.1 -p 9001 'shutdown'")
|
||||
;; (system "ssh-keygen -R \"[127.0.0.1]:9001\"")
|
||||
;; (sleep 30)
|
||||
;; (system "rm ~/.guix/qemu/guix-installer.qcow2")
|
||||
;; (system "mv ~/.guix/home/guix-user.qcow2 ~/.guix/qemu/")
|
||||
;; (start)
|
||||
;; (sleep 15)
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo mkdir /Users'"))
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; (newline)
|
||||
;; (display "Reconfiguring MSG, this may take a few minutes...")
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo guix system reconfigure --allow-downgrades /etc/config.scm'")
|
||||
;; (system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo shutdown'")
|
||||
;; (display "\nMSG is ready to be started. Run 'msg machine start' to begin.\n"))
|
||||
;; (display "MSG already initialized. Please run `msg machine reinit` if you would like to recreate it."))
|
||||
(newline)
|
||||
(display "Reconfiguring MSG, this may take a few minutes...")
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo guix system reconfigure --allow-downgrades /etc/config.scm'")
|
||||
(system "ssh -o StrictHostKeyChecking=no -i $HOME/.guix/ssh-cert/msg_rsa admin@127.0.0.1 -p 9001 'sudo shutdown'")
|
||||
(display "\nMSG is ready to be started. Run 'msg machine start' to begin.\n"))
|
||||
(display "MSG already initialized. Please run `msg machine reinit` if you would like to recreate it."))
|
||||
|
||||
|
||||
;; )
|
||||
)
|
||||
|
||||
(define (build-msg)
|
||||
;; Build MSG
|
||||
|
|
Loading…
Add table
Reference in a new issue