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:
parent
263ab83e83
commit
12281d8dee
@ -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:
|
||||
|
@ -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,17 +68,23 @@ branches:
|
||||
# - p8
|
||||
|
||||
scripts:
|
||||
securetty: |
|
||||
#!/bin/sh
|
||||
securetty:
|
||||
contents: |
|
||||
#!/bin/sh
|
||||
|
||||
echo pts/0 >> /etc/securetty
|
||||
var: |
|
||||
#!/bin/sh
|
||||
echo pts/0 >> /etc/securetty
|
||||
global: no
|
||||
number: 1
|
||||
var:
|
||||
contents: |
|
||||
#!/bin/sh
|
||||
|
||||
for dir in run lock; do
|
||||
mkdir -p "/$dir"
|
||||
mv /var/"$dir"/* "/$dir"
|
||||
rmdir "/var/$dir"
|
||||
ln -sf "/$dir" /var
|
||||
done
|
||||
for dir in run lock; do
|
||||
mkdir -p "/$dir"
|
||||
mv /var/"$dir"/* "/$dir"
|
||||
rmdir "/var/$dir"
|
||||
ln -sf "/$dir" /var
|
||||
done
|
||||
global: yes
|
||||
number: 27
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user