165 |
local variable="$2" |
local variable="$2" |
166 |
local method |
local method |
167 |
|
|
168 |
|
local use_sudo="" |
169 |
|
case ${SUDO} in |
170 |
|
yes|y|true|1) use_sudo=sudo ;; |
171 |
|
esac |
172 |
|
|
173 |
case $1 in |
case $1 in |
174 |
--uuid|-u) shift; method="-U"; partition="$1"; variable="$2" ;; |
--uuid|-u) shift; method="-U"; partition="$1"; variable="$2" ;; |
175 |
--label|-l) shift; method="-L"; partition="$1"; variable="$2" ;; |
--label|-l) shift; method="-L"; partition="$1"; variable="$2" ;; |
187 |
return 1 |
return 1 |
188 |
fi |
fi |
189 |
|
|
190 |
blkid -o value -s "${variable}" "${method}" "${partition}" |
${use_sudo} blkid -o value -s "${variable}" "${method}" "${partition}" |
191 |
} |
} |
192 |
|
|
193 |
get_fstype() |
get_fstype() |
261 |
local minimum_size="$2" |
local minimum_size="$2" |
262 |
local size |
local size |
263 |
|
|
264 |
|
local use_sudo="" |
265 |
|
case ${SUDO} in |
266 |
|
yes|y|true|1) use_sudo=sudo ;; |
267 |
|
esac |
268 |
|
|
269 |
[[ -z ${device} ]] && dialog_die "Error: device_minimum_size() no \$device given!" |
[[ -z ${device} ]] && dialog_die "Error: device_minimum_size() no \$device given!" |
270 |
[[ -z ${minimum_size} ]] && dialog_die "Error: device_minimum_size() no \$minium_size given!" |
[[ -z ${minimum_size} ]] && dialog_die "Error: device_minimum_size() no \$minium_size given!" |
271 |
|
|
272 |
# convert to bytes |
# convert to bytes |
273 |
minimum_size=$(( ${minimum_size}*1024*1024 )) |
minimum_size=$(( ${minimum_size}*1024*1024 )) |
274 |
|
|
275 |
size=$(fdisk -l ${device} | grep "Disk.*${device}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
size=$(${use_sudo} fdisk -l ${device} | grep "Disk.*${device}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
276 |
[[ ${size} -ge ${minimum_size} ]] || return 1 |
[[ ${size} -ge ${minimum_size} ]] || return 1 |
277 |
|
|
278 |
return 0 |
return 0 |
282 |
{ |
{ |
283 |
local cmd="$@" |
local cmd="$@" |
284 |
|
|
285 |
|
local use_sudo="" |
286 |
|
case ${SUDO} in |
287 |
|
yes|y|true|1) use_sudo=sudo ;; |
288 |
|
esac |
289 |
|
|
290 |
is_mounted --location ${INSTALLROOT}/sys || mount -t sysfs sysfs ${INSTALLROOT}/sys |
is_mounted --location ${INSTALLROOT}/sys || mount -t sysfs sysfs ${INSTALLROOT}/sys |
291 |
is_mounted --location ${INSTALLROOT}/proc || mount -t proc proc ${INSTALLROOT}/proc |
is_mounted --location ${INSTALLROOT}/proc || mount -t proc proc ${INSTALLROOT}/proc |
292 |
is_mounted --location ${INSTALLROOT}/dev || mount -o bind /dev ${INSTALLROOT}/dev |
is_mounted --location ${INSTALLROOT}/dev || mount -o bind /dev ${INSTALLROOT}/dev |
293 |
|
|
294 |
chroot ${INSTALLROOT} ${cmd} |
${use_sudo} chroot ${INSTALLROOT} ${cmd} |
295 |
|
|
296 |
is_mounted --location ${INSTALLROOT}/dev && umount ${INSTALLROOT}/dev |
is_mounted --location ${INSTALLROOT}/dev && umount ${INSTALLROOT}/dev |
297 |
is_mounted --location ${INSTALLROOT}/proc && umount ${INSTALLROOT}/proc |
is_mounted --location ${INSTALLROOT}/proc && umount ${INSTALLROOT}/proc |