811a5758 | 07-Dec-2021 |
Andrew Jeffery <andrew@aj.id.au> |
overlay: Accept multiple targets for add and remove subcommands
Make operating on overlays less tedious
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I29897c85adec7987e0302ee17802280c3
overlay: Accept multiple targets for add and remove subcommands
Make operating on overlays less tedious
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I29897c85adec7987e0302ee17802280c3ab591c0
show more ...
|
727d135f | 07-Dec-2021 |
Andrew Jeffery <andrew@aj.id.au> |
overlay: Be explicit about the subcommand
This allows us to treat the remaining arguments as a list tail. However for now assume we have just the one tail element.
Signed-off-by: Andrew Jeffery <an
overlay: Be explicit about the subcommand
This allows us to treat the remaining arguments as a list tail. However for now assume we have just the one tail element.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Id6ef984e37c5d4b6dace6ca338db58716aee86e8
show more ...
|
f6823abd | 07-Dec-2021 |
Andrew Jeffery <andrew@aj.id.au> |
overlay: Lift remove implementation to overlay_remove()
Improve readability by isolating the implementation
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie0fc7857a9d882c29d0406445afa0
overlay: Lift remove implementation to overlay_remove()
Improve readability by isolating the implementation
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ie0fc7857a9d882c29d0406445afa053e3adeb591
show more ...
|
ba2e744d | 06-Sep-2021 |
Andrew Jeffery <andrew@aj.id.au> |
Add overlay script
`overlay` does the tedious work of setting up and tearing down the environment required for overlay filesystems. Example use:
``` root@bmc:~# touch /usr/share/vpd/foo touch: /usr
Add overlay script
`overlay` does the tedious work of setting up and tearing down the environment required for overlay filesystems. Example use:
``` root@bmc:~# touch /usr/share/vpd/foo touch: /usr/share/vpd/foo: Read-only file system root@bmc:~# ./overlay add /usr/share/vpd [53864.956641] overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off. root@bmc:~# touch /usr/share/vpd/foo root@bmc:~# ls -l /usr/share/vpd/foo -rw-r--r-- 1 root root 0 Sep 6 23:55 /usr/share/vpd/foo root@bmc:~# rm /usr/share/vpd/foo root@bmc:~# ls -l /usr/share/vpd/foo ls: /usr/share/vpd/foo: No such file or directory root@bmc:~# ./overlay remove /usr/share/vpd root@bmc:~# touch /usr/share/vpd/foo touch: /usr/share/vpd/foo: Read-only file system ```
The `rm -rf` specifically removes the temporary directories specified in the mount options:
``` root@bmc:~# ./overlay add /usr/share/vpd root@bmc:~# sh -x ./overlay remove /usr/share/vpd + set -eu + '[' 2 -lt 2 ']' + case $1 in + o_lowerdir=/usr/share/vpd ++ fstab_fs_mntopt /usr/share/vpd ++ awk '"overlay" == $1 && "/usr/share/vpd" == $2 { printf("%s\n", $4) }' + o_options=rw,relatime,lowerdir=/usr/share/vpd,upperdir=/tmp/tmp.v8vJ35,workdir=/tmp/tmp.6v1YJY + umount /usr/share/vpd + '[' -z rw,relatime,lowerdir=/usr/share/vpd,upperdir=/tmp/tmp.v8vJ35,workdir=/tmp/tmp.6v1YJY ']' + fstab_option_iter + tr , '\n' + echo rw,relatime,lowerdir=/usr/share/vpd,upperdir=/tmp/tmp.v8vJ35,workdir=/tmp/tmp.6v1YJY + read FS_MNTOPT + case $FS_MNTOPT in + read FS_MNTOPT + case $FS_MNTOPT in + read FS_MNTOPT + case $FS_MNTOPT in + read FS_MNTOPT + case $FS_MNTOPT in ++ echo upperdir=/tmp/tmp.v8vJ35 ++ fstab_option_value ++ cut -d= -f2 + rm -rf /tmp/tmp.v8vJ35 + read FS_MNTOPT + case $FS_MNTOPT in ++ fstab_option_value ++ cut -d= -f2 ++ echo workdir=/tmp/tmp.6v1YJY + rm -rf /tmp/tmp.6v1YJY + read FS_MNTOPT root@bmc:~# ```
It also safely handles bad remove invocations:
``` root@bmc:~# sh -x ./overlay remove /asdf + set -eu + '[' 2 -lt 2 ']' + case $1 in + o_lowerdir=/asdf ++ fstab_fs_mntopt /asdf ++ awk '"overlay" == $1 && "/asdf" == $2 { printf("%s\n", $4) }' + o_options= + umount /asdf umount: /asdf: no mount point specified. root@bmc:~# sh -x ./overlay remove / + set -eu + '[' 2 -lt 2 ']' + case $1 in + o_lowerdir=/ ++ fstab_fs_mntopt / ++ awk '"overlay" == $1 && "/" == $2 { printf("%s\n", $4) }' + o_options= + umount / + '[' -z '' ']' + echo / is not an overlay / is not an overlay + exit 1 root@bmc:~# ```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I0118c645d9edf391d9670aacc889f31d1e1b2f5f
show more ...
|