Skip to content

Commit

Permalink
Merge pull request #858 from yast/ensure_installation_source_dir
Browse files Browse the repository at this point in the history
Ensure installation source dir
  • Loading branch information
jreidinger committed Oct 25, 2018
2 parents cda1f62 + fd502cc commit 27a924a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
19 changes: 14 additions & 5 deletions library/control/src/modules/Installation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@

module Yast
class InstallationClass < Module
# usual mountpoint for the source (i.e. CD)
SOURCEDIR = "/run/YaST2/mount".freeze

def main
Yast.import "Stage"
Yast.import "Linuxrc"
Expand All @@ -56,10 +59,6 @@ def main
# set to "/" when the SCR is restarted in the target system.
@scr_destdir = "/"

# usual mountpoint for the source (i.e. CD)

@sourcedir = "/var/adm/mount"

@yast2dir = "/var/lib/YaST2"

@mountlog = Ops.add(Directory.logdir, "/y2logMount")
Expand Down Expand Up @@ -287,10 +286,19 @@ def no_x11
@_no_x11
end

# Gets directory suitable for source mount. It ensures that directory exists.
# It does not ensure unmounting previous content.
#
# @return [String]
def sourcedir
::FileUtils.mkdir_p(SOURCEDIR) unless ::File.exist?(SOURCEDIR)

SOURCEDIR
end

publish variable: :scr_handle, type: "integer"
publish variable: :destdir, type: "string"
publish variable: :scr_destdir, type: "string"
publish variable: :sourcedir, type: "string"
publish variable: :yast2dir, type: "string"
publish variable: :mountlog, type: "string"
publish variable: :encoding, type: "string"
Expand Down Expand Up @@ -326,6 +334,7 @@ def no_x11
publish function: :x11_setup_needed, type: "boolean ()"
publish function: :text_fallback, type: "boolean ()"
publish function: :no_x11, type: "boolean ()"
publish function: :sourcedir, type: "string ()"
end

Installation = InstallationClass.new
Expand Down
1 change: 1 addition & 0 deletions library/control/test/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
TESTS = \
InstExtensionImage_test.rb \
installation_test.rb \
ProductFeatures_test.rb \
workflow_manager_test.rb

Expand Down
26 changes: 26 additions & 0 deletions library/control/test/installation_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env rspec

require_relative "test_helper"

Yast.import "Installation"

describe Yast::Installation do
subject { Yast::Installation }

describe ".sourcedir" do
before do
allow(::File).to receive(:exist?).and_return(true)
end

it "returns string" do
expect(subject.sourcedir).to eq "/run/YaST2/mount"
end

it "ensures that directory exists" do
expect(::File).to receive(:exist?).and_return(false)
expect(::FileUtils).to receive(:mkdir_p)

subject.sourcedir
end
end
end
9 changes: 8 additions & 1 deletion package/yast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Oct 24 15:55:08 UTC 2018 - jreidinger@suse.com

- Ensure that Installation.sourcedir exists (bsc#1097700)
- Use LSB compliant Installation.sourcedir
- 4.1.30

-------------------------------------------------------------------
Wed Oct 24 12:48:18 UTC 2018 - knut.anderssen@suse.com

Expand All @@ -24,7 +31,7 @@ Thu Oct 18 13:28:51 UTC 2018 - mvidner@suse.com

- Small CWM optimization by avoiding deep_copy on big data
(bsc#1112402).
- 4.1.26
- 4.1.26

-------------------------------------------------------------------
Wed Oct 17 15:17:04 UTC 2018 - knut.anderssen@suse.com
Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 4.1.29
Version: 4.1.30
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0-only
Expand Down

0 comments on commit 27a924a

Please sign in to comment.