Fixed debian bootstrap script calls
Run scripts as commands with their native shebang and not through bash. Not all debian package scripts uses bash, some of them uses sh which can be a link to dash or other interpreters. This Fixes #2660
This commit is contained in:
parent
0e24761929
commit
cbdddefcff
@ -557,17 +557,19 @@ class PackageManagerApt(PackageManagerBase):
|
||||
script_post = f'{package_metadata_dir}/postinst'
|
||||
# 1. preinst
|
||||
if os.path.exists(script_pre):
|
||||
Command.run(['chmod', '755', script_pre])
|
||||
Command.run(
|
||||
[
|
||||
'chroot', self.root_dir, 'bash',
|
||||
'chroot', self.root_dir,
|
||||
f'{script_pre.replace(self.root_dir, "")}', 'install'
|
||||
], self.command_env
|
||||
)
|
||||
# 2. postinst
|
||||
if os.path.exists(script_post):
|
||||
Command.run(['chmod', '755', script_post])
|
||||
Command.run(
|
||||
[
|
||||
'chroot', self.root_dir, 'bash',
|
||||
'chroot', self.root_dir,
|
||||
f'{script_post.replace(self.root_dir, "")}', 'configure'
|
||||
], self.command_env
|
||||
)
|
||||
|
||||
@ -182,13 +182,23 @@ class TestPackageManagerApt:
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/base-passwd/preinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/base-passwd/preinst', 'install'
|
||||
], new_env
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/base-passwd/postinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/base-passwd/postinst', 'configure'
|
||||
], new_env
|
||||
),
|
||||
@ -197,13 +207,23 @@ class TestPackageManagerApt:
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/base-passwd/preinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/base-passwd/preinst', 'install'
|
||||
], new_env
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/base-passwd/postinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/base-passwd/postinst', 'configure'
|
||||
], new_env
|
||||
),
|
||||
@ -212,13 +232,23 @@ class TestPackageManagerApt:
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/vim/preinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/vim/preinst', 'install'
|
||||
], new_env
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir', 'bash',
|
||||
'chmod', '755', 'tempdir/vim/postinst'
|
||||
]
|
||||
),
|
||||
call(
|
||||
[
|
||||
'chroot', 'root-dir',
|
||||
'tempdir/vim/postinst', 'configure'
|
||||
], new_env
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user