1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-25 04:20:41 +01:00

cleanup: restructure user directories

Instead of having an overlay mounted /root in the root filesystem,
move it to the other user directories, i.e. /usr/root.

We then overlay mount the entire /usr directory. This still allows
us to mount /usr from somewhere else if we wish, but cleans
up/simplifies the filesystem for now and implements some default
management of general user directories.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-04-19 07:23:15 +02:00
parent a148a9bc38
commit 7f5f64978d
6 changed files with 21 additions and 23 deletions

View file

@ -51,9 +51,9 @@ mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chmod 750 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chown 0:0 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
mkdir -p /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chmod 750 /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chown 0:0 /tmp/mnt.$$/usr/root
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -56,9 +56,9 @@ mount -t btrfs ${DEVICE}2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chmod 750 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chown 0:0 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
mkdir -p /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chmod 750 /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chown 0:0 /tmp/mnt.$$/usr/root
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -49,9 +49,9 @@ mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chmod 750 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chown 0:0 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
mkdir -p /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chmod 750 /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chown 0:0 /tmp/mnt.$$/usr/root
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -54,9 +54,9 @@ mount -t btrfs ${DEVICE}p2 /tmp/mnt.$$
MOUNTED=1
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chmod 750 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
chown 0:0 /tmp/mnt.$$/root /tmp/mnt.$$/root_work
mkdir -p /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chmod 750 /tmp/mnt.$$/usr/root /tmp/mnt.$$/usr_work
chown 0:0 /tmp/mnt.$$/usr/root
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -31,19 +31,17 @@ build() {
echo $OS_RELEASE > $PKGBUILDDIR/etc/$fname
# setup root home directory
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/root"
chmod 750 "$PKGBUILDDIR/root"
mkdir -p "$PKGBUILDDIR/cfg/preserve/usr"
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/cfg/preserve/usr/root"
chmod 750 "$PKGBUILDDIR/cfg/preserve/usr/root"
# move configuration to preserve directory
mv ${PKGBUILDDIR}/etc ${PKGBUILDDIR}/cfg/preserve
mkdir -p ${PKGBUILDDIR}/etc
mv "$PKGBUILDDIR/etc" "$PKGBUILDDIR/cfg/preserve"
mv "$PKGBUILDDIR/var/lib" "$PKGBUILDDIR/cfg/preserve/var_lib"
rm -rf "$PKGBUILDDIR/var"
mv ${PKGBUILDDIR}/var/lib ${PKGBUILDDIR}/cfg/preserve/var_lib
mv ${PKGBUILDDIR}/root ${PKGBUILDDIR}/cfg/preserve
mkdir -p ${PKGBUILDDIR}/root
chmod 750 ${PKGBUILDDIR}/root
chmod 750 ${PKGBUILDDIR}/cfg/preserve/root
mkdir -p ${PKGBUILDDIR}/{etc,var}
}
deploy() {

View file

@ -1,4 +1,4 @@
root:x:0:0:root:/root:/bin/bash
root:x:0:0:root:/usr/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false