Commit Graph

61 Commits

Author SHA1 Message Date
Marcus Schäfer
daee47ef6f
Add support for custom fstab script extension
In addition to fstab append and patch features we also allow
an fstab.script file that is called chrooted. The change is
needed to support overlay mounting of filesystems as part
of the initrd. If system filesystems needs to be changed in
a way that they can be used in an overlay mount, the standard
mount entry has to take the x-initrd.mount capability which
requires a modification of the fstab which is cumbersome to
handle as a patch file. This concept is currently used as
part of the MicroOS project in SUSE and is applied in the
integration test build maintained for this target. This
Fixes bsc#1129566
2019-08-26 17:08:49 +02:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
Stefan Seyfried
e0212272f5 remove '-z' option from rsync local copy calls
rsync's "compress" option just does not make any sense when rsync is
used to copy files locally, it only increases CPU usage and slows down
the process ;-)
2019-08-15 09:52:27 +02:00
David Cassany
afd9b3019a
Do not create a new machine-id file
This commit ensures KIWI is not creating a new machine-id empty file
in case it was not provided during the system installation.

Fixes bsc#1141168
2019-07-12 12:52:28 +02:00
David Cassany
72af33b5da
Fix locale setting
For pre-Leap 15 openSUSE versions KIWI >= 9.12.0 was not completely
setting locale, as it was missingto set the RC_LANG variable from
`/etc/sysconfig/language` file. Current commit enforces to update
locale in `/etc/sysconfig/language` (if the file exists) at the
same time it applies systemd-firstboot configurations.

Fixes #1081
2019-05-03 11:51:02 +02:00
Marcus Schäfer
7b29751b92
Fix rpm metadata creation
There are rpm versions that require access to /dev and fail
with the error message 'Failed to initialize NSS library'
For details see: https://bugs.centos.org/view.php?id=14767
Due to the rpm location checkup fix from Issue #1037 this
change impacts builds for distributions that uses an rpm
version with the above behavior (e.g CentOS) and fails as
consequence of the rpm call error. This commit fixes this
in a way that we make sure the host /dev is available at
the time of the call.
2019-04-11 09:34:28 +02:00
Marcus Schäfer
b9c0815e58
Fixed creation of image metadata files
At the end of a build process the metadata information files .packages
and .verified are created. On rpm based systems, rpm is invoked as
chrooted operation inside the new root tree. For images that gets
installed exclusively from the bootstrap phase there is no rpm inside
of the image and the call fails. The result are empty metadata files.
This patch prevents calling rpm inside of the image root tree if it's
not installed and also uses the RpmDataBase interface instead of
directly calling rpm. This Fixes #1037
2019-03-31 18:52:08 +02:00
Dan Čermák
e1ad0a33c7
Only execute scripts via bash when they are not user executable
Currently we call scripts directly through bash, which has the unfortunate
disadvantage, that the shebang line is completely ignored.
Now we instead check whether the owner of the script is allowed to execute it
and if yes, we let the OS execute it (which takes the shebang into account) or
otherwise call it through bash.
2019-03-26 15:20:56 +01:00
Marcus Schäfer
da2d1c8b1a
Support optional fstab.patch file
In addition to the support for fstab.append, users can now also
provide a patch file to change the contents of the fstab file
as it got written by kiwi. The feature is probably rarely used
but needed in the area of suse's transactional update mechanism.
This Fixes bsc#1129566 and Fixes #945
2019-03-25 11:32:24 +01:00
Marcus Schäfer
e8b66e5da3
Extend the .packages file by the license field
For rpm based builds the License field from the rpm metadata
is extracted into the .packages file. For Debian based build
the license information is in an extra file and not taken
into account for the moment.
2019-02-08 15:58:29 +01:00
Marcus Schäfer
e577c9fffb
Use chkstat to verify and fix file permissions
Call chkstat in system mode which reads /etc/sysconfig/security
to determine the configured security level and applies the
appropriate permission definitions from the /etc/permissions*
files. It's possible to provide those files as overlay files
in the image description to apply a certain permission setup
when needed. Otherwise the default setup as provided on the
package level applies. It's required that the image root system
has chkstat installed. If not present KIWI skips this step
and continuous with a warning. This Fixes #895
2019-01-05 19:52:42 +01:00
Marcus Schäfer
68d4929788
Added machine id setup in dracut preparation
In case of a dracut booted image we empty out the systemd
machine-id configuration file to trigger the rebuild of that
information by the dracut boot code at boot time. This allows
for unique systemd identifiers if the same image gets deployed
on different machines. This also makes the script implementations
people put in in config.sh or images.sh to solve this problem
obsolete. This Fixes #843
2018-10-15 09:33:25 +02:00
Marcus Schäfer
cf9ceb3453
Add config-cdroot to description import list
During the prepare step the image description and mandatory
files needed in the create step are copied into the image
root system below the image/ directory. In case of the
optional config-cdroot archive this copy action was missing
which lead to the problem that the archive was not present
if the kiwi system create command is sequence is used.
This Fixes #756
2018-06-04 10:46:49 +02:00
Marcus Schäfer
fcda2c4f9a
Added support for config-cdroot archive
The image description now allows an optional file named:
config-cdroot.tar[.compression_postfix]. The file gets
unpacked as user data for live and install ISO images.
This allows users to add e.g license files or reference
documentation to the ISO image. This Fixes #737
2018-05-28 17:25:05 +02:00
Marcus Schäfer
2b8b0f2395
Support lookup for fstab.append on fstab creation
At the time kiwi creates the fstab with all required fields
to boot the system it now also looks for an optional fstab.append
file and appends its contents to the fstab file. This allows
to setup custom fstab entries for filesystem mounts which are
established outside of the kiwi image building process by
e.g a service at first boot
2018-04-10 11:52:10 +02:00
David Cassany
d1fced5e99 Fix packages file generation
This commit checks the %_dbpath value of the image rpm tool. This is
needed since recent rpm versions switched the default database path,
thus running rpm queries to different roots might lead to errors.

Fixes #605
2018-02-02 18:16:28 +01:00
David Cassany
300dd9332d Deprecate suseConfig method and remove hardware config method
This in this commit:

- the contents of the suseConfig method from kiwi/config/functions.sh
  are replaced by a deprecated message.
- the setup_hardware_clock method from SystemSetup is removed as it is
  not used anywere in the code.
2018-01-16 17:16:04 +01:00
David Cassany Viladomat
02dc8e32e1
Update locale settings (#579)
* Use systemd-firstboot in order config basic settings

This commit updates locale and keyboard settings in order to make
use of the systemd tools, as this will be the only valid method starting
from SLE15.

Fixes #577

* Added CommandCapabilities utils class
2018-01-16 14:10:31 +01:00
David Cassany
adcdd6b463 Improve locale pattern in schema
Now the locale pattern in the schema also supports POSIX. Note
that POSIX will be only accepted if listed in the first place of the comma
separated list.

This commit fixes #570
2017-12-15 10:44:56 +01:00
Marcus Schäfer
f17b6e41f0
Make sure toplevel target dir keeps permissions
When syncing data via rsync we make sure the toplevel target
directory the data gets synced to does not change it's origin
permissions. This Fixes #557
2017-12-04 17:17:35 +01:00
Marcus Schäfer
9beb38629a
Fix trailing pipe character in .packages file
In addition make sure the field layout is consistent across
the .packages files no matter which package manager was used
to create the information. This Fixes #501
2017-09-18 14:35:23 +02:00
David Cassany
5c78697d33 Export *.verified also for images based on apt-get
This commit includes support in system/setup.py to run a package
verification also for images based in apt-get package-manger

Related to #457
2017-08-02 17:30:35 +02:00
David Cassany
4777431c93 Include .packages file for apt-get based images
This commit renames export_rpm_packages_list method to
export_packages_list and it includes support for listing
debian packages if apt-get package manager is used.

Fixes #457
2017-08-02 15:06:19 +02:00
Marcus Schäfer
b51a8e3ded
Create obs project download link like obs does it
In reference to _download_repository_link.html.erb from
https://github.com/openSUSE/open-build-service, we use the
same mechanism to create the download link from an obs://
project definition
2017-07-07 09:18:47 +02:00
David Cassany
4f18d2da22 Flag --ignore-repos do not ignore imageonly repos
This commit fixes #395, with it, using --ignore-repos, does not
delete imageonly repositories from the description file. This way
imageonly is prepared to be used in the buildservice even when using
the 'obsrepositories:/' reference style.
2017-06-27 10:02:42 +02:00
Marcus Schäfer
431afc847e
Fixed setup_plymouth_splash
The schema generated get_bootsplash_theme() method returns a list
because it's section content. The return value of the method was
used as a string which caused a runtime error
2017-06-20 18:31:07 +02:00
Marcus Schäfer
219312ec61 Setup plymouth splash in the image prepare process
In case the plymouth-set-default-theme tool can be found in the
image root system and a bootsplash theme is configured in the
XML description, the tool is used to setup the theme configuration
This Fixes #366
2017-06-19 16:13:38 +02:00
David Cassany
62095aeaf3 Improve package/repository signature checking setup
This commit adds repository_gpgcheck and package_gpgcheck attributes
to the repository tag in schema. With this change each repository
can be configured individualy to enable repository signatures check
and/or enable signature package check. The configuration is done at
repository level, thus it is not conflicting with the wide package
manager configuration flag <rpm-signatures-check>.

Fixes #358
2017-06-08 16:40:20 +02:00
Marcus Schäfer
2498ff6ba4
Fixup working dir for editboot scripts
editbootconfig and editbootinstall scripts needs to be
called from within the correct directory to allow access
to the written bootloader config files. For live images
the working directory was set to the wrong place. This
Fixes #353
2017-05-30 17:03:09 +02:00
Neal Gompa
47b799b261 Do not purge the repositories before inserting them
There are no good reasons to be purging the repo directories, especially
when it is common for some distributions (Red Hat/CentOS/Fedora, for example)
to ship repository configuration as packages. Deleting them puts the package
manager in the system into a weird state, so we want to avoid this.
2017-04-13 22:12:41 -04:00
Marcus Schäfer
6cc0b2085d Flake cleanup for unit tests 2017-03-07 13:03:10 +01:00
Marcus Schäfer
3db5a1a606 Add support for repository credentials
The package and solver repository classes did not provide an
interface to deal with repository credentials. This commit
add support for the zypper package manager and the generic
urlopen based download method of the solver class. This
Fixes #246
2017-03-02 15:35:53 +01:00
Marcus Schäfer
09a1b7df94 Cleanup unit test
Use only one instance of context manager for all tests
2016-09-21 17:07:55 +02:00
Marcus Schäfer
f938bf8a83 Create fstab entries for persistent devices
Instead of creating the fstab at boot time, those entries which
are generic and not depending on an unknown device name can be
created as part of the image building process.
2016-09-21 17:07:55 +02:00
David Cassany
330291bf9a Setup tests corrected #124 2016-08-19 17:16:42 +02:00
David Cassany
c0bcce3404 Updated the user schema layout
Now each user item may or may not have a groups attribute. The
groups attribute is a comma separated list of group names. If
present the first group name will be the login or primary group,
if not present, the underlying toolchain will assign the default
login group for that user.
2016-07-27 12:26:50 +02:00
David Cassany
2871ca8150 fixing user schema layout 2016-07-26 16:22:33 +02:00
Marcus Schäfer
2fe5f8ad7f Merge pull request #90 from SUSE/debian-based-distro-support
Debian based distro support
2016-06-10 12:17:55 +02:00
Marcus Schäfer
efa5a1b343
Fixed creation of password hashes
kiwi uses the openssl command for this purpose but did
not strip the newline at the end of the hash output
2016-06-09 11:27:31 +02:00
Marcus Schäfer
e16baa00dd Added PackageManagerApt class
Support installation/removal of deb packages
Related to #37
2016-06-08 20:41:09 +02:00
Bo Maryniuk
06b95b727d Replace 'builtins.open' with patch_open decorator 2016-06-07 17:54:24 +02:00
Marcus Schäfer
06a7472a4f Refactor import_description
split code into more readable parts
2016-05-11 22:49:22 +02:00
Marcus Schäfer
030550a280
Fixed script/archive lookup
If a script or archive is specified with an absolute path
in the image description, kiwi should not assume this path
to exist below the image description directory but just take
the absolute path as it is. Fixes #70
2016-05-10 13:02:52 +02:00
Marcus Schäfer
6b1211b8dd Added evaluation of imageincluded repositories
repositories marked as imageinclude needs to be added
permanently to the image. Fixes #56
2016-04-28 16:54:06 +02:00
Marcus Schäfer
6df0282d1c Added support for SELinux file security contexts
Systems using SELinux require the filesystem data to be labeled
according to a security context configuration. kiwi now checks
for the presence of /etc/selinux/targeted/contexts/files/file_contexts
and labels accordingly if it exists. This Fixes #52
2016-04-25 12:50:10 +02:00
Marcus Schäfer
773033eebe
Refactor SystemSetup class
the information about the description_dir is part of the
provided xml_state instance. There is no need to pass that
information along twice
2016-03-24 16:41:47 +01:00
Marcus Schäfer
cc8b18e4ea
Fixed use of derived_description_dir
Only in import_description we need to check for both locations
2016-03-24 16:29:28 +01:00
Marcus Schäfer
d8c8480fd4
Make sure import_description preserves archives 2016-03-24 16:00:48 +01:00
Marcus Schäfer
c4c3c7054f
Fixed 32bit x86 builds
Put it all under the ix86 namespace
2016-03-16 17:31:46 +01:00
Marcus Schäfer
e6cc5bfa09 Move from nose to pytest
nose is no longer maintained, thus we have to move to another
testing system. This commit updates the tox setup and all tests
to use pytest instead of nose.
2016-03-14 12:23:14 +01:00