Add options to scrips and option no_scripts to images

- global: this scritps will be used by all images
  except with explicit no_scripts declaration
- number: add this prefix to the script name
This commit is contained in:
Mikhail Gordeev 2019-06-27 01:37:25 +03:00
parent 263ab83e83
commit 12281d8dee
2 changed files with 31 additions and 15 deletions

View File

@ -301,9 +301,18 @@ Dir::Etc::preferencesparts "/var/empty";
def scripts_by_image(self, image: str) -> Dict[str, str]:
scripts = {}
for name, contents in self._scripts.items():
if name in self._images[image]['scripts']:
scripts[name] = contents
for name, value in self._scripts.items():
number = value.get('number')
if (
value.get('global', False)
and name not in self._images[image].get('no_scripts', [])
or name in self._images[image].get('scripts', [])
):
if number is not None:
if isinstance(number, int):
number = f'{number:02}'
name = f'{number}-{name}'
scripts[name] = value['contents']
return scripts
def skip_arch(self, image: str, arch: str) -> bool:

View File

@ -28,13 +28,14 @@ images:
target: ve/docker
kinds:
- tar.xz
no_scripts:
- var
rootfs-systemd:
target: ve/systemd-base
kinds:
- tar.xz
scripts:
- securetty
- var
branches:
Sisyphus:
@ -67,11 +68,15 @@ branches:
# - p8
scripts:
securetty: |
securetty:
contents: |
#!/bin/sh
echo pts/0 >> /etc/securetty
var: |
global: no
number: 1
var:
contents: |
#!/bin/sh
for dir in run lock; do
@ -80,4 +85,6 @@ scripts:
rmdir "/var/$dir"
ln -sf "/$dir" /var
done
global: yes
number: 27
...