lots of fixes, automation for bitfolk
[distro-setup] / bitfolk-rescue-init
1 #!/bin/bash
2
3 # meant to be copy/pasted
4
5 ssh bk@bk.console.bitfolk.com
6 # or
7 ssh iankelling@iankelling.console.bitfolk.com
8
9 destroy
10 rescue
11
12 sudo -i
13 mkdir -p /root/.ssh
14 chmod 700 /root/.ssh
15 cat >/root/.ssh/authorized_keys <<'EOF'
16 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDX42yru/h6r6UDRy/VwVZjcYEmNLG5/SUjv7xwu43OaW0wL+uHYg2rkfn4Ygh5o1I5pgBh2SWg8TeWuVGhgL1SCuBzzeai/+58Sny065Qak+D2WjVOuRonRelh+CBA5EpNZPuiWQkoWdf9NACTBCbS2Zu7r8OOgRqu/ruaDNePlG5+U0Wlpy3oBnpbzQiuSA3AKMW30fsCJtOBjz5qQaiPbYEKJy3AOvtbq10wliKx9TpsTzrq8dKWs7PLhZnzqVCsaq6D95IzjqXcSpx4Cga5bn+YEuAnJQ53PGA5eO+hpz6HDmawTbJlaV/Dufb9bJ/ZZy1DXzs07yWRtTEY54/X ian@iankelling.org
17 EOF
18
19 apt update
20 if [[ -e /usr/sbin/sshd ]]; then
21 systemctl restart ssh
22 else
23 apt -y install openssh-server
24 fi
25
26
27 ##### in another terminal ######
28
29 h=bk
30
31 scp -pr --chown=root:root /p/c/machine_specific/$h/filesystem/etc/ssh/ root@$h.b8.nz:/etc/ssh
32
33 scp /b/ds/bitfolk* root@$h.b8.nz:
34
35 # initially saved via:
36 # mkc /p/c/machine_specific/$h/filesystem/etc/ssh/
37 # rsync -a root@$h:/etc/ssh/ssh_host* .
38 ssh root@$h ./bitfolk-rescue-install $h
39
40 ### back to the 1st terminal
41
42 boot
43
44 # after boot, press ctrl ]
45 exit
46
47 h=bk
48 ${h}push
49 sl root@$h /a/bin/ds/distro-begin
50
51 sl $h /a/bin/ds/dall