-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- install into btrfs subvolume (fate#318392)
- Loading branch information
Showing
9 changed files
with
200 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) [2012-2015] Novell, Inc. | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact Novell, Inc. | ||
# | ||
# To contact Novell about this file by physical or electronic mail, you may | ||
# find current contact information at www.novell.com. | ||
|
||
|
||
require "yast" | ||
|
||
|
||
module Yast | ||
|
||
class StorageSnapperClass < Module | ||
|
||
|
||
include Yast::Logger | ||
|
||
|
||
def main | ||
|
||
textdomain "storage" | ||
|
||
Yast.import "String" | ||
Yast.import "Installation" | ||
Yast.import "InstExtensionImage" | ||
Yast.import "Storage" | ||
|
||
end | ||
|
||
|
||
def BashLogOutput(command) | ||
tmp = SCR.Execute(path(".target.bash_output"), command) | ||
|
||
log.info("exit: #{tmp.fetch("exit")}") | ||
tmp.fetch("stdout").each_line { |line| log.info("stdout #{line}") } | ||
tmp.fetch("stderr").each_line { |line| log.info("stderr #{line}") } | ||
|
||
return tmp.fetch("exit") | ||
end | ||
|
||
|
||
def ConfigureSnapper?() | ||
|
||
part = Storage.GetEntryForMountpoint("/") | ||
|
||
if part.fetch("used_fs", :unknown) != :btrfs | ||
return false | ||
end | ||
|
||
userdata = part.fetch("userdata", {}) | ||
if userdata.fetch("/", "") != "snapshots" | ||
return false | ||
end | ||
|
||
return true | ||
|
||
end | ||
|
||
|
||
def ConfigureSnapperStep1() | ||
|
||
log.info("configuring snapper for root fs - step 1") | ||
|
||
if ENV["YAST2_STORAGE_SNAPPER_EXTEND"] != "no" | ||
# TRANSLATORS: message in progress bar | ||
InstExtensionImage.LoadExtension("snapper", _("Retrieving %s extension...") % "snapper") | ||
end | ||
|
||
part = Storage.GetEntryForMountpoint("/") | ||
|
||
if BashLogOutput("/usr/lib/snapper/installation-helper --step 1 " << | ||
"--device '#{String.Quote(part["device"])}'") != 0 | ||
log.error("configuring snapper for root fs failed") | ||
end | ||
|
||
end | ||
|
||
|
||
def ConfigureSnapperStep2() | ||
|
||
log.info("configuring snapper for root fs - step 2") | ||
|
||
part = Storage.GetEntryForMountpoint("/") | ||
|
||
if BashLogOutput("/usr/lib/snapper/installation-helper --step 2 " << | ||
"--device '#{String.Quote(part["device"])}' " << | ||
"--root-prefix '#{String.Quote(Installation.destdir)}' " << | ||
"--default-subvolume-name '#{String.Quote(Storage.DefaultSubvolumeName())}'") != 0 | ||
log.error("configuring snapper for root fs failed") | ||
end | ||
|
||
end | ||
|
||
|
||
def ConfigureSnapperStep3() | ||
|
||
log.info("configuring snapper for root fs - step 3") | ||
|
||
if BashLogOutput("/usr/lib/snapper/installation-helper --step 3 " << | ||
"--root-prefix '#{String.Quote(Installation.destdir)}' " << | ||
"--default-subvolume-name '#{String.Quote(Storage.DefaultSubvolumeName())}'") != 0 | ||
log.error("configuring snapper for root fs failed") | ||
end | ||
|
||
if ENV["YAST2_STORAGE_SNAPPER_EXTEND"] != "no" | ||
# TRANSLATORS: message in progress bar | ||
InstExtensionImage.UnLoadExtension("snapper", _("Releasing %s extension...") % "snapper") | ||
end | ||
|
||
end | ||
|
||
|
||
def ConfigureSnapperStep4() | ||
|
||
log.info("configuring snapper for root fs - step 4") | ||
|
||
if BashLogOutput("/usr/lib/snapper/installation-helper --step 4") != 0 | ||
log.error("configuring snapper for root fs failed") | ||
end | ||
|
||
BashLogOutput("/usr/bin/snapper --no-dbus set-config " << | ||
"NUMBER_CLEANUP=yes NUMBER_LIMIT=10 NUMBER_LIMIT_IMPORTANT=10 " << | ||
"TIMELINE_CREATE=no") | ||
|
||
SCR.Write(path(".sysconfig.yast2.USE_SNAPPER"), "yes") | ||
SCR.Write(path(".sysconfig.yast2"), nil) | ||
|
||
end | ||
|
||
end | ||
|
||
StorageSnapper = StorageSnapperClass.new | ||
StorageSnapper.main | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters