From 2401423e2bd3c03ce022814a9874139f26344580 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 7 Dec 2020 08:56:41 +0100 Subject: [PATCH] install: fix crash if /etc/skel is missing (MR 2001) Create an empty home dir if /etc/skel does not exist in the target rootfs. Due to changes in packaging, this can happen now, previously /etc/skel would always have existed. --- pmb/install/_install.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 7184f9c9..fa7a7dc0 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -178,7 +178,10 @@ def create_home_from_skel(args): rootfs = args.work + "/chroot_native/mnt/install" homedir = rootfs + "/home/" + args.user pmb.helpers.run.root(args, ["mkdir", rootfs + "/home"]) - pmb.helpers.run.root(args, ["cp", "-a", rootfs + "/etc/skel", homedir]) + if os.path.exists(f"{rootfs}/etc/skel"): + pmb.helpers.run.root(args, ["cp", "-a", f"{rootfs}/etc/skel", homedir]) + else: + pmb.helpers.run.root(args, ["mkdir", homedir]) pmb.helpers.run.root(args, ["chown", "-R", "10000", homedir])