[cowdancer] 04/11: qemubuilder.c: Update script by mounting root
James Clarke
jrtc27-guest at moszumanska.debian.org
Mon May 2 01:19:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
jrtc27-guest pushed a commit to branch master
in repository cowdancer.
commit 19c0a9e1b60d524932b9b0a5d36435b9610568cf
Author: James Clarke <jrtc27 at jrtc27.com>
Date: Sun May 1 23:07:20 2016 +0100
qemubuilder.c: Update script by mounting root
---
qemubuilder.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 53 insertions(+), 13 deletions(-)
diff --git a/qemubuilder.c b/qemubuilder.c
index e4bf6e0..b509a3f 100755
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -702,8 +702,6 @@ static int run_second_stage_script
(
/** save the result of this command*/
int save_result,
- /** update first stage script */
- int update_first_stage,
/** the command-line to invoke within QEMU */
const char* commandline,
const struct pbuilderconfig* pc,
@@ -809,13 +807,6 @@ static int run_second_stage_script
/* copy files script */
f = create_script(pc->buildplace, "input/run-copyfiles");
- if (update_first_stage)
- {
- FILE *g = create_script(pc->buildplace, "input/pbuilder-run-first-stage");
- write_first_stage(g, pc);
- fclose(g);
- copy_file_contents_in_temp(f, "input/pbuilder-run-first-stage", "/", "pbuilder-run");
- }
copy_file_contents_through_temp(f, "/etc/hosts", pc->buildplace, "/etc");
copy_file_contents_through_temp(f, "/etc/hostname", pc->buildplace, "/etc");
/* copy inputfile */
@@ -1231,7 +1222,7 @@ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile)
pc->buildresultuid, pc->buildresultgid);
ret=run_second_stage_script
- (0, 0,
+ (0,
commandline, pc,
hoststr,
hoststr2);
@@ -1246,7 +1237,6 @@ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile)
int cpbuilder_login(const struct pbuilderconfig* pc)
{
return run_second_stage_script(pc->save_after_login,
- 0,
EXECUTE_HOOKS("H")
EXECUTE_HOOKS("F")
"bash",
@@ -1277,7 +1267,6 @@ int cpbuilder_execute(const struct pbuilderconfig* pc, char** av)
EXECUTE_HOOKS("F")
"sh $BUILDDIR/input/runscript");
ret=run_second_stage_script(pc->save_after_login,
- 0,
runcommandline,
pc,
hostcommand,
@@ -1294,6 +1283,55 @@ int cpbuilder_execute(const struct pbuilderconfig* pc, char** av)
*/
int cpbuilder_update(const struct pbuilderconfig* pc)
{
+ int ret;
+
+ ret = do_fsck(pc->basepath);
+ if (ret)
+ {
+ fprintf(stderr,
+ "E: Failed fsck '%s'\n",
+ pc->basepath);
+ return ret;
+ }
+
+ if (mkdir(pc->buildplace,0777))
+ {
+ fprintf(stderr,
+ "E: Could not create directory '%s': %s\n",
+ pc->buildplace,
+ strerror(errno));
+ return 1;
+ }
+
+ ret = loop_mount(pc->basepath, pc->buildplace);
+ if (ret)
+ {
+ fprintf(stderr,
+ "E: Could not mount '%s' on '%s'\n",
+ pc->basepath,
+ pc->buildplace);
+ return ret;
+ }
+ FILE *g = create_script(pc->buildplace, "pbuilder-run");
+ write_first_stage(g, pc);
+ fclose(g);
+ ret = loop_umount(pc->buildplace);
+ if (ret)
+ {
+ fprintf(stderr,
+ "E: Could not unmount '%s'\n",
+ pc->buildplace);
+ return ret;
+ }
+ ret = rmdir(pc->buildplace);
+ if (ret)
+ {
+ fprintf(stderr,
+ "E: Could not rmdir '%s'\n",
+ pc->buildplace);
+ return ret;
+ }
+
/* TODO: --override-config support, --othermirror support etc.
There is no way to change distribution in this code-path...
*/
@@ -1316,7 +1354,9 @@ int cpbuilder_update(const struct pbuilderconfig* pc)
return 1;
}
- return run_second_stage_script(1, 1, script, pc, NULL, NULL);
+ ret = run_second_stage_script(1, script, pc, NULL, NULL);
+ free(script);
+ return ret;
}
int cpbuilder_help(void)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/cowdancer.git
More information about the Pbuilder-maint
mailing list