-
Notifications
You must be signed in to change notification settings - Fork 14
/
check_image.sh
39 lines (37 loc) · 2.39 KB
/
check_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Author Brokedba https://twitter.com/BrokeDba
echo "******* Oci Image Selecta ! ************"
echo "Choose your Destiny ||{**}||"
echo
PS3='Select an option and press Enter: '
options=("Oracle-Linux" "CentOS" "Oracle Autonomus Linux" "Ubuntu" "Windows" "Exit?" "All")
select opt in "${options[@]}"
do
case $opt in
"Oracle-Linux")
oci compute image list -c $C --query "reverse(sort_by(data[?contains(\"display-name\",'Oracle-Linux')],&\"time-created\")) |[0:1].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\",time:\"time-created\"}" --output table --all
;;
"CentOS")
oci compute image list -c $C --query "reverse(sort_by(data[?contains(\"display-name\",'CentOS')],&\"time-created\")) |[0:1].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\",time:\"time-created\"}" --output table --all
break
;;
"Oracle Autonomus Linux")
oci compute image list -c $C --query "reverse(sort_by(data[?contains(\"display-name\",'Oracle-Autonomous-Linux')],&\"time-created\")) |[0:1].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\",time:\"time-created\"}" --output table --all
;;
"Ubuntu")
oci compute image list -c $C --query "reverse(sort_by(data[?contains(\"display-name\",'Canonical-Ubuntu')],&\"time-created\")) |[0:1].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\",time:\"time-created\"}" --output table --all
;;
"Windows")
oci compute image list -c $C --query "reverse(sort_by(data[?contains(\"display-name\",'Windows')],&\"time-created\")) |[0:1].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\",time:\"time-created\"}" --output table --all
;;
"All")
oci compute image list -c $C --query "reverse(sort_by(data[*],&\"display-name\")) |[*].{ImageName:\"display-name\", OCID:id, OS:\"operating-system\", Size:\"size-in-mbs\"}" --output table --all
;;
"Exit?")
exit
;;
*) echo "invalid option";;
esac
done
echo "*********************"
#ocid_img=$(oci compute image list -c $C --operating-system "Oracle Linux" --operating-system-version "7.8" --shape "VM.Standard2.1" --query 'data[0].id' --raw-output)