浏览文件
00-alpine-user-group.sh
26 行 · 663 B历史下载| 1 | |
| 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 | touch "$LIMA_REBOOT_REQUIRED" |
| 24 | reboot |
| 25 | fi |
| 26 | fi |

