| ttowards make_qemu_img - libdevuansdk - common library for devuan's simple distro kits |
| git clone https://git.parazyd.org/libdevuansdk |
| Log |
| Files |
| Refs |
| Submodules |
| README |
| LICENSE |
| --- |
| commit 510875218b04e350b12efb5daab37a33d305e629 |
| parent 333d0505c927b4288c27f46359c70d09882ca9b3 |
| Author: KatolaZ |
| Date: Sun, 12 Jun 2016 18:21:43 +0100
ttowards make_qemu_img
Diffstat:
M zlibs/customise | 24 ++++++++++++++++++++++++
M zlibs/helpers | 13 +++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
--- |
| diff --git a/zlibs/customise b/zlibs/customise |
| t@@ -48,3 +48,26 @@ install_default_kernel(){
umountdevprocsys ${root}
notice "default kernel installed"
}
+
+
+make_qemu_img(){
+
+ fn make_qemu_img $@
+ local imgfile=$1
+ local imgsize=${2:-4G}
+ local imgformat=${3:-qcow2}
+ req=(strapdir os release version arch imgfile imgsize)
+ root=$strapdir
+ reqck || return 1
+
+
+ check_executable qemu-img || error "Could not find qemu-img!!!" && return 1
+
+ qemu-img create -f ${imgformat} ${imgfile} ${imgsize}
+
+ if [[ ! -z ${imgfile} ]]; then
+ notice "QEMU image created in ::1" ${imgfile}
+ else
+ warning "Unable to create QEMU image file in ::1" ${imgfile}
+ fi
+}
+\ No newline at end of file |
| diff --git a/zlibs/helpers b/zlibs/helpers |
| t@@ -174,3 +174,15 @@ silly() {
[[ arg1 == "sleep" ]] && sleep $arg2
}
+
+check_executable() {
+ fn check_executable $@
+ progname=$1
+
+ if [[ `which $progname | grep "not found" | wc -l` -ge 1 ]]; then
+ return 0;
+ else
+ return 1;
+ fi
+
+}
+\ No newline at end of file |