-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a mount script instead of editing /etc/fstab #15
Conversation
sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/fstab | ||
echo "#LIMA-START" >> /etc/fstab | ||
awk -f- "${LIMA_CIDATA_MNT}"/user-data <<'EOF' >> /etc/fstab | ||
MOUNT_SCRIPT=/etc/lima-mounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not sure (as a script) it should live in /etc
. But I guess that doesn't hurt? It's not as if /etc/init.d/
isn't full of scripts…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know where else to put it. And I wanted to keep a record of it, which is why I didn't just pipe it into the shell.
@@ -49,15 +49,17 @@ awk -f- "${LIMA_CIDATA_MNT}"/user-data <<'EOF' >> /etc/fstab | |||
flag = 0 | |||
} | |||
flag { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit can use more documentation.
Given a line like:
- [mount1, /tmp/rancher-desktop, 9p, "rw,trans=virtio,version=9p2000.L,msize=131072,cache=mmap,nofail", "0", "0"]
@@ -49,15 +49,17 @@ awk -f- "${LIMA_CIDATA_MNT}"/user-data <<'EOF' >> /etc/fstab | |||
flag = 0 | |||
} | |||
flag { | |||
# Use a pattern unlikely to appear in a filename. "\0" unfortunately doesn't work. | |||
FS = "<;><><;>" | |||
sub(/^ *- \[/, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strips the -[
prefix…
@@ -49,15 +49,17 @@ awk -f- "${LIMA_CIDATA_MNT}"/user-data <<'EOF' >> /etc/fstab | |||
flag = 0 | |||
} | |||
flag { | |||
# Use a pattern unlikely to appear in a filename. "\0" unfortunately doesn't work. | |||
FS = "<;><><;>" | |||
sub(/^ *- \[/, "") | |||
sub(/"?\] *$/, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strips the ]
suffix, possibly with a "
in front…
sub(/^ *- \[/, "") | ||
sub(/"?\] *$/, "") | ||
gsub("\"?, \"?", "\t") | ||
print $0 | ||
gsub("\"?, \"?", FS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this… replaces ", "
with the field separator? So it's a very limited YAML parse.
This enables support for mount points that include spaces. `/etc/fstab` normally supports encoding special characters in filenames using octal constants (like "\040` for a space), but that doesn't work on Alpine. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
This enables support for mount points that include spaces.
/etc/fstab
normally supports encoding special characters in filenames using octal constants (like "\040` for a space), but that doesn't work on Alpine.