lorax/setup.py

54 lines
1.7 KiB
Python
Raw Normal View History

2013-07-24 20:41:03 +00:00
#!/usr/bin/python
2010-02-23 13:20:05 +00:00
from distutils.core import setup
import os
import sys
2010-10-12 16:23:29 +00:00
# config file
data_files = [("/etc/lorax", ["etc/lorax.conf"]),
2017-11-23 00:37:00 +00:00
("/etc/lorax", ["etc/composer.conf"]),
("/usr/lib/systemd/system", ["systemd/lorax-composer.service",
"systemd/lorax-composer.socket"]),
lorax: Move default tmp dir to /var/tmp/lorax If systemd's tmpfiles.d timer is executed while lorax is running it will remove any files and directories older than 30 days. This is what has been causing the occasional error where /proc/ would seem to vanish during the install. Upstream has proposed this solution, https://github.com/systemd/systemd/pull/11482 but until that is released we need a work-around to protect the lorax files. This commit does several things: * Move the default tmpdir from /var/tmp/ to /var/tmp/lorax/ * Add a lorax.conf tmpfiles.d file that prevents systemd-tmpfiles from removing anything under /var/tmp/lorax/ * Add an exit handler to lorax so that temporary directories are removed on exit or on a python traceback. * Use flock to lock access to the tempdir while lorax is running. * Remove any unlocked tempdirs named /var/tmp/lorax/lorax.* at startup Note that the exit handler will not remove the tempdir if lorax is killed with a signal -- those are being caught by dnf and prevent the exit handler from running. systemd-tmpfiles cannot clean up the tempdirs at boot time because they contain files labeled as shadow_t, so we have to remove those when lorax runs. It uses the flock to prevent removing any directories created by parallel instances of lorax and only removes ones that are unlocked. Worst case they will be around until the first run of lorax after a reboot. If you want to keep the working directory around for debugging purposes use --workdir /var/tmp/lorax/my-workdir and it won't be removed by lorax. Resolves: rhbz#1668520
2019-01-18 20:06:18 +00:00
("/usr/lib/tmpfiles.d/", ["systemd/lorax-composer.conf",
"systemd/lorax.conf"])]
2010-10-12 16:23:29 +00:00
# shared files
for root, dnames, fnames in os.walk("share"):
for fname in fnames:
data_files.append((root.replace("share", "/usr/share/lorax", 1),
[os.path.join(root, fname)]))
# executable
2011-12-16 23:48:02 +00:00
data_files.append(("/usr/sbin", ["src/sbin/lorax", "src/sbin/mkefiboot",
"src/sbin/livemedia-creator", "src/sbin/lorax-composer"]))
data_files.append(("/usr/bin", ["src/bin/image-minimizer",
"src/bin/mk-s390-cdboot",
"src/bin/composer-cli"]))
# get the version
sys.path.insert(0, "src")
try:
import pylorax.version
except ImportError:
vernum = "devel"
else:
vernum = pylorax.version.num
finally:
sys.path = sys.path[1:]
2010-02-23 13:20:05 +00:00
setup(name="lorax",
version=vernum,
2010-02-23 13:20:05 +00:00
description="Lorax",
long_description="Tools for creating bootable images, including the Anaconda boot.iso",
author="Brian C. Lane, Will Woods, Martin Gracik",
author_email="bcl@redhat.com",
url="https://rhinstaller.github.io/lorax/",
download_url="https://github.com/rhinstaller/lorax/releases",
2010-02-23 13:20:05 +00:00
license="GPLv2+",
packages=["pylorax", "pylorax.api", "composer", "composer.cli"],
2010-02-23 13:20:05 +00:00
package_dir={"" : "src"},
data_files=data_files
)