diff --git a/.zshrc b/.zshrc index c80bcd0..cef2b61 100644 --- a/.zshrc +++ b/.zshrc @@ -27,7 +27,7 @@ done ########## # color for zsh auto complete suggestion output https://stackoverflow.com/questions/23152157/how-does-the-zsh-list-colors-syntax-work -zstyle ':completion:*:commands' ignored-patterns '.DS_Store|.gitignore|macos-homebrew.sh|macos-mouse-shortcuts.sh|macos-podmandesktop-init.sh|macos-settings|macos-skhd.sh|macos-yabai.sh|yabai_cycle_clockwise.sh' +zstyle ':completion:*:commands' ignored-patterns '.DS_Store|.gitignore|macos-settings|macos-setup|vm|yabai_cycle_clockwise.sh' zstyle ':completion:*:commands' list-colors '=*=31' zstyle ':completion:*:options' list-colors '=^(-- *)=36' zstyle ':completion:*:parameters' list-colors '=*=36' diff --git a/bin/cloud-init.yaml b/bin/cloud-init.yaml deleted file mode 100644 index 0bf15cc..0000000 --- a/bin/cloud-init.yaml +++ /dev/null @@ -1,55 +0,0 @@ -#cloud-config -autoinstall: - version: 1 - identity: - hostname: vm - username: ubuntu - password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" - # ubuntu - ssh: - install-server: true - allow-pw: false - packages: - - openssh-server - timezone: "Etc/UTC" - updates: all - shutdown: poweroff - late-commands: - # add ip address to TTY login screen - - echo 'IyEvdXNyL2Jpbi9lbnYgYmFzaApzZXQgLWV1eAoKIyBodHRwczovL3NlcnZlcmZhdWx0LmNvbS9xdWVzdGlvbnMvMjA5NTk5L2hvdy10by1zZXR1cC1ldGMtaXNzdWVzLXRvLXNob3ctdGhlLWlwLWFkZHJlc3MtZm9yLWV0aDAKCiMgZG9uJ3QgcnVuIGluIG1hY09TCmlmIFtbICEgLWUgL1VzZXJzIF1dICYmIHdob2FtaSB8IGdyZXAgInJvb3QiIDsgdGhlbgogIGlmIFtbICEgLWYgL2V0Yy8uaXNzdWUub3JpZyBdXSA7IHRoZW4KICAgIGNwIC9ldGMvaXNzdWUgL2V0Yy8uaXNzdWUub3JpZwogIGZpCiAgaW50PSQoIGxzIC9zeXMvY2xhc3MvbmV0IHwgZ3JlcCAiZW5wIiB8IGhlYWQgLTEgKQogIHNlZCAtciAicy9eVWJ1bnR1L1xcXDRceyRpbnRcfSAtIFVidW50dS8iIDwgL2V0Yy8uaXNzdWUub3JpZyA+IC9ldGMvaXNzdWUKICBzeXN0ZW1jdGwgcmVzdGFydCBnZXR0eUB0dHkxCmZpCg==' | base64 -d > /target/sbin/ubuntu-tty-update.sh - - curtin in-target -- chmod 755 /sbin/ubuntu-tty-update.sh - - curtin in-target -- test -d /etc/network/if-up.d || curtin in-target -- install -d -m 755 -o root -g root /etc/network/if-up.d - - curtin in-target -- ln -sf /sbin/ubuntu-tty-update.sh /etc/network/if-up.d/update-issue - - curtin in-target -- test -d /etc/network/if-post-down.d || curtin in-target -- install -d -m 755 -o root -g root /etc/network/if-post-down.d - - curtin in-target -- ln -sf /sbin/ubuntu-tty-update.sh /etc/network/if-post-down.d/update-issue - # extend logical volume - - curtin in-target -- lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv - - curtin in-target -- resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv - user-data: - users: - - name: lab - homedir: /home/lab - shell: /bin/bash - lock_passwd: true - gecos: lab - groups: adm, cdrom, dip, lxd, plugdev, sudo - primary_group: lab - ssh_import_id: - - gh:johnko - sudo: ALL=(ALL) NOPASSWD:ALL - - name: ubuntu - expiredate: "2000-01-01" - homedir: /home/ubuntu - shell: /bin/bash - lock_passwd: true - gecos: ubuntu - groups: ubuntu - primary_group: ubuntu - sudo: false - package_update: true - package_upgrade: true - packages: - - openssh-server - - docker.io - - docker-compose - ssh_pwauth: false diff --git a/bin/macos-dock-tilesize.sh b/bin/macos-dock-tilesize.sh index 660463a..e8cd978 100755 --- a/bin/macos-dock-tilesize.sh +++ b/bin/macos-dock-tilesize.sh @@ -14,9 +14,9 @@ print_cmd(){ fi echo "defaults write $DOMAIN $KEY $TYPE $VAL" fi - done < /target/sbin/ubuntu-tty-update.sh + - curtin in-target -- chmod 755 /sbin/ubuntu-tty-update.sh + # cat bin/ubuntu-tty-update.service | gzip -c - | base64 + - echo 'H4sIACWwjGcAA3WOMRKCMBBF+5yCCwROkEJHClvRsWAoAqyyY9hgdqPk9mZkLK3/vPdfeyGUTh2Ah4CLoCcT+0gSC5FUxGW0AuoEz4gB2BDI24eH9uSQoBQb7iBqdxMIfzbVNhBeOECnzmkB4wl48pKVs0X6kvWKYhKwqlcYmsyJqbhHqrYQnUP0FlLylIVHYrHOdepqSWDcJzNHJ6gjQ/jdfgAt+l2E1wAAAA==' | base64 -d | zcat > /target/etc/systemd/system/ubuntu-tty-update.service + - curtin in-target -- chmod 644 /etc/systemd/system/ubuntu-tty-update.service + - curtin in-target -- systemctl enable ubuntu-tty-update.service + # # temp cronjob to update TTY login screen + # - echo '* * * * * root /sbin/ubuntu-tty-update.sh' > /target/etc/cron.d/update_issue + # - curtin in-target -- chmod 644 /etc/cron.d/update_issue + # extend logical volume + - curtin in-target -- lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv + - curtin in-target -- resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv + user-data: + users: + - name: lab + homedir: /home/lab + shell: /bin/bash + lock_passwd: true + gecos: lab + groups: adm, cdrom, dip, lxd, plugdev, sudo + primary_group: lab + ssh_import_id: + - gh:johnko + sudo: ALL=(ALL) NOPASSWD:ALL + - name: ubuntu + homedir: /home/ubuntu + shell: /bin/bash + lock_passwd: true + gecos: ubuntu + groups: adm, cdrom, dip, lxd, plugdev, sudo + primary_group: ubuntu + sudo: ALL=(ALL) NOPASSWD:ALL + package_update: true + package_upgrade: true + packages: + - openssh-server + - docker.io + - docker-compose + ssh_pwauth: false diff --git a/bin/vm/ubuntu-tty-update.service b/bin/vm/ubuntu-tty-update.service new file mode 100644 index 0000000..873ee1b --- /dev/null +++ b/bin/vm/ubuntu-tty-update.service @@ -0,0 +1,12 @@ +[Unit] +Description=ubuntu tty update +Requires=network-online.target +After=network-online.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/sbin/ubuntu-tty-update.sh + +[Install] +WantedBy=multi-user.target diff --git a/bin/ubuntu-tty-update.sh b/bin/vm/ubuntu-tty-update.sh similarity index 71% rename from bin/ubuntu-tty-update.sh rename to bin/vm/ubuntu-tty-update.sh index 2f40913..d0b331e 100755 --- a/bin/ubuntu-tty-update.sh +++ b/bin/vm/ubuntu-tty-update.sh @@ -3,12 +3,13 @@ set -eux # https://serverfault.com/questions/209599/how-to-setup-etc-issues-to-show-the-ip-address-for-eth0 +export PATH="/usr/bin:$PATH" + # don't run in macOS if [[ ! -e /Users ]] && whoami | grep "root" ; then if [[ ! -f /etc/.issue.orig ]] ; then cp /etc/issue /etc/.issue.orig fi - int=$( ls /sys/class/net | grep "enp" | head -1 ) - sed -r "s/^Ubuntu/\\\4\{$int\} - Ubuntu/" < /etc/.issue.orig > /etc/issue + grep -q "\\\4" /etc/issue || sed -r "s/^Ubuntu/\\\4 - Ubuntu/" < /etc/.issue.orig > /etc/issue systemctl restart getty@tty1 fi diff --git a/bin/vm/vm-firstboot.sh b/bin/vm/vm-firstboot.sh new file mode 100644 index 0000000..8eed4fb --- /dev/null +++ b/bin/vm/vm-firstboot.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eux + +git clone https://github.com/johnko/homedir + +mv homedir/.git ./ + +rm -fr homedir + +git checkout . + +cat <