Create device dirs if they do not exist

Some build environments (e.g. Google Cloud Container Builder docker
images) don't have enough of a /dev filesystem to have
/dev/disk/by-uuid/ by default. Make them if they don't exist.
This commit is contained in:
Graham Forest 2018-03-28 11:01:41 -07:00
parent a9efdb4bf9
commit 114a069a99
No known key found for this signature in database
GPG key ID: C63AB6AFC547E18C

View file

@ -86,6 +86,7 @@ class BasePartition(AbstractPartition):
# $GRUB_DEVICE_UUID when creating /boot/grub/grub.cfg # $GRUB_DEVICE_UUID when creating /boot/grub/grub.cfg
self.disk_by_uuid_path = os.path.join('/dev/disk/by-uuid', self.get_uuid()) self.disk_by_uuid_path = os.path.join('/dev/disk/by-uuid', self.get_uuid())
if not os.path.exists(self.disk_by_uuid_path): if not os.path.exists(self.disk_by_uuid_path):
os.makedirs(os.path.dirname(self.disk_by_uuid_path))
os.symlink(self.device_path, self.disk_by_uuid_path) os.symlink(self.device_path, self.disk_by_uuid_path)
def unlink_uuid(self): def unlink_uuid(self):