Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/pkg/cidata/cidata.TEMPLATE.d/boot/00-alpine-user-group.sh
2667 views
1
#!/bin/sh
2
3
# SPDX-FileCopyrightText: Copyright The Lima Authors
4
# SPDX-License-Identifier: Apache-2.0
5
6
test -f /etc/alpine-release || exit 0
7
8
# Make sure that root is in the sudoers file.
9
# This is needed to run the user provisioning scripts.
10
SUDOERS=/etc/sudoers.d/00-root-user
11
if [ ! -f $SUDOERS ]; then
12
echo "root ALL=(ALL) NOPASSWD:ALL" >$SUDOERS
13
chmod 660 $SUDOERS
14
fi
15
16
# Remove the user embedded in the image,
17
# and use cloud-init for users and groups.
18
if [ "$LIMA_CIDATA_USER" != "alpine" ]; then
19
if [ "$(id -u alpine 2>&1)" = "1000" ]; then
20
userdel alpine
21
rmdir /home/alpine
22
cloud-init clean --logs
23
reboot
24
fi
25
fi
26
27