From 36dc1b7a2ea44321a2c233fd7ea576ed516d4ccc Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 1 Dec 2023 21:39:58 -0600 Subject: Add 'rootshell' key to determine root's shell * Key added to code and documentation. * Tests added and pass locally on gwyn (ppc64) and fran (aarch64). * Qt UI automatically sets /bin/zsh as root's shell (ref: packages#206). * ISO image creator backend no longer has root shell hack. --- tests/fixtures/0265-rootshell-basic.installfile | 6 ++++++ tests/fixtures/0266-rootshell-invalid.installfile | 6 ++++++ tests/fixtures/0267-rootshell-duplicate.installfile | 7 +++++++ tests/spec/validator_spec.rb | 18 ++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 tests/fixtures/0265-rootshell-basic.installfile create mode 100644 tests/fixtures/0266-rootshell-invalid.installfile create mode 100644 tests/fixtures/0267-rootshell-duplicate.installfile (limited to 'tests') diff --git a/tests/fixtures/0265-rootshell-basic.installfile b/tests/fixtures/0265-rootshell-basic.installfile new file mode 100644 index 0000000..e23477b --- /dev/null +++ b/tests/fixtures/0265-rootshell-basic.installfile @@ -0,0 +1,6 @@ +network false +hostname 123lonelycorgi.street +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +rootshell /bin/zsh diff --git a/tests/fixtures/0266-rootshell-invalid.installfile b/tests/fixtures/0266-rootshell-invalid.installfile new file mode 100644 index 0000000..012fc67 --- /dev/null +++ b/tests/fixtures/0266-rootshell-invalid.installfile @@ -0,0 +1,6 @@ +network false +hostname 123lonelycorgi.street +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +rootshell lol hi! diff --git a/tests/fixtures/0267-rootshell-duplicate.installfile b/tests/fixtures/0267-rootshell-duplicate.installfile new file mode 100644 index 0000000..3cd25c7 --- /dev/null +++ b/tests/fixtures/0267-rootshell-duplicate.installfile @@ -0,0 +1,7 @@ +network false +hostname 123lonelycorgi.street +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +rootshell /bin/zsh +rootshell /bin/dash diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index 3a491a0..8f33330 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -732,6 +732,19 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do expect(last_command_started).to have_output(/error: .*version.*/) end end + context "for 'rootshell' key" do + it "succeeds with zsh" do + use_fixture '0265-rootshell-basic.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "fails with an invalid shell" do + use_fixture '0266-rootshell-invalid.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*rootshell.*/) + end + end context "for 'pkginstall' key" do it "warns when a package is listed twice in the same line" do use_fixture '0216-pkginstall-dup-single.installfile' @@ -1284,6 +1297,11 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do run_validate expect(last_command_started).to have_output(/error: .*duplicate.*timezone/) end + it "fails with a duplicate 'rootshell' key" do + use_fixture '0267-rootshell-duplicate.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*duplicate.*rootshell/) + end end context "user account keys:" do context "'username'" do -- cgit v1.2.3-60-g2f50