summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'backend/bundlers/ext2')
-rw-r--r--backend/bundlers/ext2/bundle.php6
-rw-r--r--backend/bundlers/ext2/cp.php6
-rw-r--r--backend/bundlers/ext2/mkfs.php4
-rw-r--r--backend/bundlers/ext2/tar.php3
4 files changed, 19 insertions, 0 deletions
diff --git a/backend/bundlers/ext2/bundle.php b/backend/bundlers/ext2/bundle.php
new file mode 100644
index 0000000..2418453
--- /dev/null
+++ b/backend/bundlers/ext2/bundle.php
@@ -0,0 +1,6 @@
+<?php
+add_step('mkfs');
+add_step('cp');
+add_step('tar');
+return "$workdir/image.ext2.gz";
+?>
diff --git a/backend/bundlers/ext2/cp.php b/backend/bundlers/ext2/cp.php
new file mode 100644
index 0000000..befbd91
--- /dev/null
+++ b/backend/bundlers/ext2/cp.php
@@ -0,0 +1,6 @@
+<?php
+makedir('ext2');
+execute_command('Mount ext2 image', "mount -o loop -t ext2 '$workdir/image.ext2' '$workdir/ext2'");
+execute_command('Copy files to ext2', "cp -va '$imagedir/*' '$workdir/ext2/'");
+execute_command('Unmount ext2 image', "umount '$workdir/ext2'");
+?>
diff --git a/backend/bundlers/ext2/mkfs.php b/backend/bundlers/ext2/mkfs.php
new file mode 100644
index 0000000..925c93f
--- /dev/null
+++ b/backend/bundlers/ext2/mkfs.php
@@ -0,0 +1,4 @@
+<?php
+execute_command('Make blank file for ext2 image', "dd if=/dev/zero of='$workdir/image.ext2' bs=1024 count=1048576");
+execute_command('Make ext2 filesystem', "mke2fs -t ext2 -F '$workdir/image.ext2'");
+?>
diff --git a/backend/bundlers/ext2/tar.php b/backend/bundlers/ext2/tar.php
new file mode 100644
index 0000000..5e51e1d
--- /dev/null
+++ b/backend/bundlers/ext2/tar.php
@@ -0,0 +1,3 @@
+<?php
+execute_command('Compress ext2 image', "gzip '$workdir/image.ext2'");
+?>