Merge ~kajiya/+git/next-demo:additonal-edits-for-kara into ~kajiya/+git/next-demo:main

Proposed by Chloé Smith
Status: Merged
Merged at revision: 150674da6c4da1210b1130159aa2a34159b05718
Proposed branch: ~kajiya/+git/next-demo:additonal-edits-for-kara
Merge into: ~kajiya/+git/next-demo:main
Diff against target: 84 lines (+24/-16)
2 files modified
main.sh (+6/-5)
on-instance.sh (+18/-11)
Reviewer Review Type Date Requested Status
Ankush Pathak (community) Approve
Review via email: mp+462244@code.launchpad.net

Commit message

feat: Pin to an older focal image and add more meat to on-instance.sh

* Do an apt update and install additional packages for a more verbose
  pro status
* Minor tweaks (added -r to prevent backclashes being globbed on
  `read`), etc.

To post a comment you must log in.
Revision history for this message
Ankush Pathak (ankushpathak) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/main.sh b/main.sh
2index 3d3781a..f1c099f 100755
3--- a/main.sh
4+++ b/main.sh
5@@ -2,7 +2,7 @@
6
7 INSTANCE_NAME=focal-$(petname)
8 ZONE="us-central1-a"
9-FAMILY="ubuntu-2004-lts"
10+IMAGE_NAME="ubuntu-2004-focal-v20231213"
11 PROJECT="${1}"
12
13 PUB_KEYNAME=${INSTANCE_NAME}.rsa.pub
14@@ -42,9 +42,10 @@ launch_instance(){
15 touch ${INSTANCE_NAME}_hosts_file
16 ssh-keygen -t rsa -f ${INSTANCE_NAME}.rsa -C ubuntu -b 2048 -N ""
17
18- gcloud compute os-login ssh-keys add --key-file=${PUB_KEYNAME} --project=${PROJECT} --ttl=2h
19-
20- gcloud compute instances create ${INSTANCE_NAME} --machine-type n2d-standard-4 --project ${PROJECT} --image-family ${FAMILY} --image-project=ubuntu-os-cloud --zone ${ZONE} --metadata=ssh-keys=${PRIVATE_KEYNAME}
21+ gcloud compute instances create ${INSTANCE_NAME} --machine-type n2d-standard-4 --project ${PROJECT} --image ${IMAGE_NAME} --image-project=ubuntu-os-cloud --zone ${ZONE} --metadata=ssh-keys=${PRIVATE_KEYNAME},startup-script='#! /bin/bash
22+ apt update
23+ apt -y install mongodb ros-base-python-dev
24+ EOF'
25
26 echo "Waiting for instance to launch..."
27
28@@ -67,7 +68,7 @@ launch_instance(){
29 while true; do
30 clear
31 printf "Press any key to begin."
32- read
33+ read -r
34 launch_instance
35 if command -v cowsay >/dev/null;
36 then
37diff --git a/on-instance.sh b/on-instance.sh
38index 5bca750..8fdeb28 100644
39--- a/on-instance.sh
40+++ b/on-instance.sh
41@@ -4,25 +4,32 @@ set -e
42 clear
43
44 echo "=========================================================="
45-echo "You are on an Ubuntu 20.04 instance on Google Cloud."
46-echo "Why do you need Ubuntu Pro? Press enter to run the command"
47-printf "\$ pro security-status"
48-read
49+echo "You are on an Ubuntu 20.04 instance in Google Cloud."
50+echo "Why do you need Ubuntu Pro? Type 'pro security-status' and run the command to find out"
51+read -r USER_INPUT
52+while [ "${USER_INPUT}" != "pro security-status" ]; do
53+ echo "Ooops! Please try typing that again."
54+ read -r USER_INPUT
55+done
56+echo "Running ${USER_INPUT}"
57 pro security-status
58-read -p "Return to continue."
59 echo "=========================================================="
60 echo "You seem like a Pro. Would you like to make your instance Pro too?"
61 printf "\$ sudo pro attach xxxxxxxTOKENxGOESxHERExxxxxxx"
62-read
63+read -r
64 TOKEN=$(cat token)
65 sudo pro attach "${TOKEN}"
66-read -p "Return to continue."
67+read -r -p "Return to continue."
68 echo "=========================================================="
69 echo "Your instance is now a Pro too."
70-echo "Go to ubuntu.com/pro to get your free token. Return to continue."
71-read
72-read -p "Would you like to switch to a bash session?(y/n)[n]" answer
73-if [ "${answer}" != "y" ];
74+echo "Let's look at the esm-apps installed..."
75+pro security-status --esm-apps
76+echo "=========================================================="
77+echo "Go to ubuntu.com/pro to get your free token."
78+read -r -p "Return to continue."
79+echo "=========================================================="
80+read -r -p "Would you like to switch to a bash session?(y/n)[n]" ANSWER
81+if [ "${ANSWER}" != "y" ];
82 then
83 exit
84 fi

Subscribers

People subscribed via source and target branches

to all changes: