|
|
@@ -0,0 +1,56 @@ |
|
1 |
+ |
function oci-launch-arm64 |
|
2 |
+ |
set -l USERDATA (mktemp -t oci) |
|
3 |
+ |
echo '#!/bin/sh -eux |
|
4 |
+ |
set -o pipefail |
|
5 |
+ |
touch /var/run/cloud_script_was_here |
|
6 |
+ |
sed -i"" -E -e "s/.*ssh-/ssh-/" /root/.ssh/authorized_keys |
|
7 |
+ |
# https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm |
|
8 |
+ |
curl --fail -H Authorization:\ Bearer\ Oracle -s \ |
|
9 |
+ |
http://169.254.169.254/opc/v2/instance \ |
|
10 |
+ |
| jq . > /var/run/oci_metadata.json |
|
11 |
+ |
mkdir -p /usr/local/etc/pkg/repos |
|
12 |
+ |
sed -E -e s/quarterly/latest/ /etc/pkg/FreeBSD.conf \ |
|
13 |
+ |
| tee /usr/local/etc/pkg/repos/FreeBSD.conf |
|
14 |
+ |
pkg upgrade -yr FreeBSD |
|
15 |
+ |
pkg install -Uyr FreeBSD \ |
|
16 |
+ |
devel/git@tiny \ |
|
17 |
+ |
devel/oci-cli \ |
|
18 |
+ |
sysutils/fd \ |
|
19 |
+ |
shells/fish \ |
|
20 |
+ |
sysutils/htop \ |
|
21 |
+ |
net/mosh \ |
|
22 |
+ |
editors/neovim \ |
|
23 |
+ |
net/ngrep \ |
|
24 |
+ |
devel/ninja \ |
|
25 |
+ |
textproc/ripgrep \ |
|
26 |
+ |
net/rsync \ |
|
27 |
+ |
security/sudo \ |
|
28 |
+ |
sysutils/tmux |
|
29 |
+ |
' | tee $USERDATA |
|
30 |
+ |
# FreeBSD-14.3-RELEASE-arm64-zfs |
|
31 |
+ |
set -l IMAGE_OCID 'ocid1.image.oc1..aaaaaaaakcp6qvubkpqzprnfca6hpgencllptvuu5cw7tr6thnublyj6vcla' |
|
32 |
+ |
set -l SUBNET_OCID 'ocid1.subnet.oc1....' |
|
33 |
+ |
set -l TENANCY_OCID 'ocid1.tenancy.oc1.....' |
|
34 |
+ |
set -l COMPARTMENT_OCID $TENANCY_OCID |
|
35 |
+ |
set -l AVAILABILITY_DOMAIN 'hENZ:EU-FRANKFURT-1-AD-3' |
|
36 |
+ |
|
|
37 |
+ |
# https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/compute/instance/launch.html#cmdoption-shape |
|
38 |
+ |
set -l SHAPE 'VM.Standard.A1.Flex' |
|
39 |
+ |
set -l SHAPE_CONFIG '{"memoryInGBs": 6, "ocpus": 2}' |
|
40 |
+ |
set -l TAGS '{"GIT_REPO":"https://git.sr.ht/~dch/src", "GIT_REF":"13.2-oci", "IMG_ARCH":"arm64", "IMG_NAME": "FreeBSD-13.2-RELEASE-20230411-1455-99eb544-amd64-amd64.img"}' |
|
41 |
+ |
oci compute instance launch \ |
|
42 |
+ |
--availability-domain $AVAILABILITY_DOMAIN \ |
|
43 |
+ |
--compartment-id $COMPARTMENT_OCID \ |
|
44 |
+ |
--image-id $IMAGE_OCID \ |
|
45 |
+ |
--subnet-id $SUBNET_OCID \ |
|
46 |
+ |
--shape $SHAPE \ |
|
47 |
+ |
--shape-config $SHAPE_CONFIG \ |
|
48 |
+ |
--boot-volume-size-in-gbs 50 \ |
|
49 |
+ |
--ssh-authorized-keys-file ~/.ssh/id_ed25519.pub \ |
|
50 |
+ |
--wait-for-state RUNNING \ |
|
51 |
+ |
--display-name $argv[1] \ |
|
52 |
+ |
--hostname-label $argv[1] \ |
|
53 |
+ |
--freeform-tags $TAGS \ |
|
54 |
+ |
--user-data-file $USERDATA |
|
55 |
+ |
rm -f $USERDATA |
|
56 |
+ |
end |