Skip to content

Commit 875ea10

Browse files
committed
exec init when pid is 1, exit otherwise
Signed-off-by: Zen <[email protected]>
1 parent 11dbb04 commit 875ea10

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ugrd/fs/mounts.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ def _mount_fail(self) -> list[str]:
294294
'echo -e "\n\n\nPress enter to restart init\n\n\n"',
295295
'read -sr',
296296
'clean_mounts',
297-
'exec /init']
297+
'if [ "$$" -eq 1 ]; then',
298+
' echo "Restarting init"',
299+
' exec /init',
300+
'else',
301+
' echo "PID is not 1, exiting: $$"',
302+
' exit',
303+
'fi']
298304

299305

0 commit comments

Comments
 (0)