1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-05-17 11:06:13 +02:00

Some rootfs restructuring

- Dedicate home directory for root user (classic /root)
 - Root homedirectory is overlay mounted
 - Allows us to have an empty user directory that we directly
   mount, i.e. without using overlay fs

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-01-23 16:34:33 +01:00
parent 2426f1f32c
commit 077f72f529
9 changed files with 19 additions and 5 deletions

View file

@ -8,11 +8,11 @@ deploy() {
local DEPLOY="$3"
# home directory of root user
mkdir -p "$DEPLOY/usr/root"
chmod 750 "$DEPLOY/usr/root"
mkdir -p "$DEPLOY/root"
chmod 750 "$DEPLOY/root"
cp "$SCRIPTDIR/pkg/base-files/bash_profile" "$DEPLOY/usr/root/.bash_profile"
cp "$SCRIPTDIR/pkg/base-files/bashrc" "$DEPLOY/usr/root/.bashrc"
cp "$SCRIPTDIR/pkg/base-files/bash_profile" "$DEPLOY/root/.bash_profile"
cp "$SCRIPTDIR/pkg/base-files/bashrc" "$DEPLOY/root/.bashrc"
# /etc base files
mkdir -p "$DEPLOY/etc/skel"

View file

@ -1 +1 @@
root:x:0:0:root:/usr/root:/bin/bash
root:x:0:0:root:/root:/bin/bash

View file

@ -96,9 +96,11 @@ if [ ! -z "$overlay_dev" ]; then
overlay_mount "cfg/preserve/etc" "cfg/overlay/etc" "etc"
overlay_mount "cfg/preserve/var_lib" "cfg/overlay/var_lib" "var/lib"
overlay_mount "cfg/preserve/root" "cfg/overlay/root" "root"
else
bind_mount "cfg/preserve/etc" "etc"
bind_mount "cfg/preserve/var_lib" "var/lib"
bind_mount "cfg/preserve/root" "root"
fi
# cleanup mounts

View file

@ -47,6 +47,7 @@ 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
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -57,6 +57,7 @@ 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
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -44,6 +44,7 @@ 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
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -54,6 +54,7 @@ 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
umount /tmp/mnt.$$
MOUNTED=0

View file

@ -30,6 +30,10 @@ build() {
mkdir -p ${BUILD}/etc
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
mv ${BUILD}/root ${BUILD}/cfg/preserve
mkdir -p ${BUILD}/root
chmod 750 ${BUILD}/root
}
deploy() {

View file

@ -31,6 +31,10 @@ build() {
mkdir -p ${BUILD}/etc
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
mv ${BUILD}/root ${BUILD}/cfg/preserve
mkdir -p ${BUILD}/root
chmod 750 ${BUILD}/root
}
deploy() {