From: Arvin Schnell Date: Mon, 29 Jan 2018 10:36:25 +0000 (+0100) Subject: - create subvolume instead of snapshot for initial system X-Git-Tag: v0.5.4^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75686ebbacac5fcfa837d587e61747230eef3e94;p=thirdparty%2Fsnapper.git - create subvolume instead of snapshot for initial system --- diff --git a/client/installation-helper.cc b/client/installation-helper.cc index 13da6442..da22de24 100644 --- a/client/installation-helper.cc +++ b/client/installation-helper.cc @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 Novell, Inc. + * Copyright (c) 2018 SUSE LLC * * All Rights Reserved. * @@ -90,18 +91,30 @@ step1(const string& device, const string& description, const string& cleanup, btrfs.createConfig(); - cout << "creating snapshot" << endl; + cout << "creating subvolume" << endl; Snapper snapper("root", tmp_mount.getFullname()); SCD scd; scd.read_only = false; + scd.empty = true; scd.description = description; scd.cleanup = cleanup; scd.userdata = userdata; Snapshots::iterator snapshot = snapper.createSingleSnapshot(scd); + cout << "again copying config-file" << endl; + + string ris = tmp_mount.getFullname() + snapshot->snapshotDir(); + + mkdir((ris + "/etc").c_str(), 0777); + mkdir((ris + "/etc/snapper").c_str(), 0777); + mkdir((ris + "/etc/snapper/configs").c_str(), 0777); + + system(("/bin/cp " + tmp_mount.getFullname() + "/etc/snapper/configs/root " + ris + + "/etc/snapper/configs").c_str()); + cout << "setting default subvolume" << endl; snapper.getFilesystem()->setDefault(snapshot->getNum()); @@ -132,6 +145,8 @@ step2(const string& device, const string& root_prefix, const string& default_sub subvol_option += "/"; subvol_option += ".snapshots"; + mkdir((root_prefix + "/.snapshots").c_str(), 0777); + SDir s_dir(root_prefix + "/.snapshots"); if (!s_dir.mount(device, "btrfs", 0, "subvol=" + subvol_option)) { diff --git a/package/snapper.changes b/package/snapper.changes index ed7b2143..a5cc4518 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,9 +1,15 @@ +------------------------------------------------------------------- +Mon Jan 29 11:32:56 CET 2018 - aschnell@suse.com + +- create subvolume instead of snapshot for initial system + (bsc#1077240) +- version 0.5.4 + ------------------------------------------------------------------- Fri Jan 26 14:36:20 CET 2018 - aschnell@suse.com - improved error handling for systemd services (gh#openSUSE/snapper#382) -- version 0.5.4 ------------------------------------------------------------------- Wed Jan 10 14:33:11 CET 2018 - aschnell@suse.com