-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdlimg
executable file
·152 lines (139 loc) · 2.69 KB
/
dlimg
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
# Copyright (c) 2024 Osamu Aoki <[email protected]>
# GNU GPL 2+
VERSION='0.0.1'
help() {
cat - << EOF
Usage: ${0##*/} [options]
OPTION:
-n no download
-a [am|ar] set extention type of downloaded data
amd64 (default), arm64
-c [s|b|t] set codename and release of downloaded data
sid (default), bookworm, trixie
-i [n|g|c|a|e] set image name of downloaded data
nocloud (default), generic, genericcloud, azure, ec2
-e [j|q|r|t] set extention type of downloaded data
json (default), qcow2, raw, tar.xz
-h show help message
This is ${0##*/} version $VERSION .
NOTE:
Difference of image names
* azure: Microsoft Azure environment
* ec2: Amazon EC2
* generic: Any, with cloud-init
* genericcloud: Any, with cloud-init, w/o hardware drivers
* nocloud Any, with password-less root login for build process
EOF
}
REPO_URL="https://cloud.debian.org/images/cloud"
CODEIMAGE="sid"
REPO_PATH="daily/latest"
DIST="debian"
RELEASE="sid"
IMAGE="nocloud"
ARCH="amd64"
SUFFIX="daily"
EXT="json"
ECHO=""
while [ $# != 0 ]; do
case $1 in
-a) # ARCH
shift
case $1 in
am*)
shift
ARCH="amd64"
;;
ar*)
shift
ARCH="arm64"
;;
*) ;;
esac
;;
-c) # CODEIMAGE/RELEASE
shift
case $1 in
b* | 12)
shift
CODEIMAGE="bookworm"
RELEASE="12"
;;
t* | 13)
shift
CODEIMAGE="trixie"
RELEASE="13"
;;
s*)
shift
CODEIMAGE="sid"
RELEASE="sid"
;;
*) ;;
esac
;;
-i) # IMAGE
shift
case $1 in
a*)
shift
IMAGE="azure"
;;
e*)
shift
IMAGE="ec2"
;;
g*)
shift
IMAGE="generic"
;;
c*)
shift
IMAGE="genericcloud"
;;
n*)
shift
IMAGE="nocloud"
;;
*) ;;
esac
;;
-e) # EXTENSION
shift
case $1 in
j*)
shift
EXT="json"
;;
q*)
shift
EXT="qcow2"
;;
r*)
shift
EXT="raw"
;;
t*)
shift
EXT="tar.gz"
;;
*) ;;
esac
;;
-n)
shift
ECHO="echo"
;;
-h)
help
shift
exit 0
;;
*)
break
;;
esac
done
$ECHO wget ${REPO_URL}/${CODEIMAGE}/${REPO_PATH}/${DIST}-${RELEASE}-${IMAGE}-${ARCH}-${SUFFIX}.${EXT}
# vim: set sts=2 sw=2 et si ai: