Browse Source

Add config file and force timestamp conditional option

master
Melg Eight 4 months ago
parent
commit
cf4ce56603
No known key found for this signature in database GPG Key ID: 8F73D998D1992669
  1. 7
      rootfs.py
  2. 13
      sysa.py
  3. 9
      sysa/helpers.sh
  4. 7
      sysa/run2.sh

7
rootfs.py

@ -9,6 +9,7 @@ you can run bootstap inside chroot.
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Bastian Bittorf <bb@npl.de>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
import argparse
import glob
@ -33,6 +34,9 @@ def main():
parser.add_argument("-p", "--preserve", help="Do not unmount temporary dir",
action="store_true")
parser.add_argument("-t", "--tmpdir", help="Temporary directory")
parser.add_argument("--force_timestamps",
help="Force all files timestamps to be 0 unix time",
action="store_true")
# QEMU arguments
parser.add_argument("-q", "--qemu-cmd", help="QEMU command",
@ -52,7 +56,8 @@ def main():
if args.arch != "x86":
raise ValueError("Only x86 is supported at the moment.")
system_a = SysA(arch=args.arch, preserve_tmp=args.preserve, tmpdir=args.tmpdir)
system_a = SysA(arch=args.arch, preserve_tmp=args.preserve, tmpdir=args.tmpdir,
force_timestamps=args.force_timestamps)
initramfs_path = os.path.join(system_a.tmp_dir, "initramfs")
if not args.chroot:

13
sysa.py

@ -18,7 +18,7 @@ class SysA:
"""
Class responsible for preparing sources for System A.
"""
def __init__(self, arch, preserve_tmp, tmpdir):
def __init__(self, arch, preserve_tmp, tmpdir, force_timestamps):
self.git_dir = os.path.dirname(os.path.join(__file__))
self.arch = arch
self.preserve_tmp = preserve_tmp
@ -29,6 +29,7 @@ class SysA:
self.tmp_dir = tmpdir
self.sysa_dir = os.path.join(self.git_dir, 'sysa')
self.after_dir = os.path.join(self.tmp_dir, 'after')
self.force_timestamps = force_timestamps
self.prepare()
@ -187,6 +188,7 @@ class SysA:
"""
self.create_after_dirs()
self.create_configuration_file()
self.mescc_tools_checksum()
self.deploy_extra_files()
self.mescc_tools_extra()
@ -194,6 +196,15 @@ class SysA:
self.tcc_0_9_26()
self.get_packages()
def create_configuration_file(self):
"""
Creates bootstrap.cfg file which would contain options used to
customize bootstrap.
"""
config_path = os.path.join(self.after_dir, "bootstrap.cfg")
with open(config_path, "w") as config:
config.write("FORCE_TIMESTAMPS=" + str(self.force_timestamps))
def create_after_dirs(self):
"""
Create some empty directories for early bootstrap

9
sysa/helpers.sh

@ -3,6 +3,7 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -149,3 +150,11 @@ call() {
default() {
"default_${build_stage}"
}
# Set all files modified dates to be 0 unix time.
# Should be called at the end of bootstrapping process.
# This function needs `touch` that supports --no-dereference
# (at least coreutils 8.1).
canonicalise_all_files_timestamp() {
find / -exec touch --no-dereference -t 197001010000.00 {} +
}

7
sysa/run2.sh

@ -11,6 +11,8 @@ set -e
. helpers.sh
. bootstrap.cfg
build xz-5.0.5
build automake-1.11.2
@ -31,6 +33,11 @@ build mpfr-4.1.0
build mpc-1.2.1
if [ "$FORCE_TIMESTAMPS" = True ] ; then
echo 'Forcing all files timestamps to be 0 unix time.'
canonicalise_all_files_timestamp
fi
echo "Bootstrapping completed."
exec env - PATH=/after/bin PS1="\w # " bash -i
Loading…
Cancel
Save