mirror of
https://github.com/pygos/build.git
synced 2024-11-22 11:09:46 +01: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:
parent
2426f1f32c
commit
077f72f529
9 changed files with 19 additions and 5 deletions
|
@ -8,11 +8,11 @@ deploy() {
|
||||||
local DEPLOY="$3"
|
local DEPLOY="$3"
|
||||||
|
|
||||||
# home directory of root user
|
# home directory of root user
|
||||||
mkdir -p "$DEPLOY/usr/root"
|
mkdir -p "$DEPLOY/root"
|
||||||
chmod 750 "$DEPLOY/usr/root"
|
chmod 750 "$DEPLOY/root"
|
||||||
|
|
||||||
cp "$SCRIPTDIR/pkg/base-files/bash_profile" "$DEPLOY/usr/root/.bash_profile"
|
cp "$SCRIPTDIR/pkg/base-files/bash_profile" "$DEPLOY/root/.bash_profile"
|
||||||
cp "$SCRIPTDIR/pkg/base-files/bashrc" "$DEPLOY/usr/root/.bashrc"
|
cp "$SCRIPTDIR/pkg/base-files/bashrc" "$DEPLOY/root/.bashrc"
|
||||||
|
|
||||||
# /etc base files
|
# /etc base files
|
||||||
mkdir -p "$DEPLOY/etc/skel"
|
mkdir -p "$DEPLOY/etc/skel"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
root:x:0:0:root:/usr/root:/bin/bash
|
root:x:0:0:root:/root:/bin/bash
|
||||||
|
|
|
@ -96,9 +96,11 @@ if [ ! -z "$overlay_dev" ]; then
|
||||||
|
|
||||||
overlay_mount "cfg/preserve/etc" "cfg/overlay/etc" "etc"
|
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/var_lib" "cfg/overlay/var_lib" "var/lib"
|
||||||
|
overlay_mount "cfg/preserve/root" "cfg/overlay/root" "root"
|
||||||
else
|
else
|
||||||
bind_mount "cfg/preserve/etc" "etc"
|
bind_mount "cfg/preserve/etc" "etc"
|
||||||
bind_mount "cfg/preserve/var_lib" "var/lib"
|
bind_mount "cfg/preserve/var_lib" "var/lib"
|
||||||
|
bind_mount "cfg/preserve/root" "root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanup mounts
|
# cleanup mounts
|
||||||
|
|
|
@ -47,6 +47,7 @@ mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
|
||||||
MOUNTED=1
|
MOUNTED=1
|
||||||
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
||||||
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
||||||
|
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
|
||||||
umount /tmp/mnt.$$
|
umount /tmp/mnt.$$
|
||||||
MOUNTED=0
|
MOUNTED=0
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ mount -t btrfs ${DEVICE}2 /tmp/mnt.$$
|
||||||
MOUNTED=1
|
MOUNTED=1
|
||||||
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
||||||
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
||||||
|
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
|
||||||
umount /tmp/mnt.$$
|
umount /tmp/mnt.$$
|
||||||
MOUNTED=0
|
MOUNTED=0
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ mount -t btrfs ${LODEV}p2 /tmp/mnt.$$
|
||||||
MOUNTED=1
|
MOUNTED=1
|
||||||
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
||||||
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
||||||
|
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
|
||||||
umount /tmp/mnt.$$
|
umount /tmp/mnt.$$
|
||||||
MOUNTED=0
|
MOUNTED=0
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ mount -t btrfs ${DEVICE}p2 /tmp/mnt.$$
|
||||||
MOUNTED=1
|
MOUNTED=1
|
||||||
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
mkdir /tmp/mnt.$$/etc /tmp/mnt.$$/etc_work
|
||||||
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
mkdir /tmp/mnt.$$/var_lib /tmp/mnt.$$/var_lib_work
|
||||||
|
mkdir /tmp/mnt.$$/root /tmp/mnt.$$/root_work
|
||||||
umount /tmp/mnt.$$
|
umount /tmp/mnt.$$
|
||||||
MOUNTED=0
|
MOUNTED=0
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ build() {
|
||||||
mkdir -p ${BUILD}/etc
|
mkdir -p ${BUILD}/etc
|
||||||
|
|
||||||
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
|
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
|
||||||
|
|
||||||
|
mv ${BUILD}/root ${BUILD}/cfg/preserve
|
||||||
|
mkdir -p ${BUILD}/root
|
||||||
|
chmod 750 ${BUILD}/root
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy() {
|
deploy() {
|
||||||
|
|
|
@ -31,6 +31,10 @@ build() {
|
||||||
mkdir -p ${BUILD}/etc
|
mkdir -p ${BUILD}/etc
|
||||||
|
|
||||||
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
|
mv ${BUILD}/var/lib ${BUILD}/cfg/preserve/var_lib
|
||||||
|
|
||||||
|
mv ${BUILD}/root ${BUILD}/cfg/preserve
|
||||||
|
mkdir -p ${BUILD}/root
|
||||||
|
chmod 750 ${BUILD}/root
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy() {
|
deploy() {
|
||||||
|
|
Loading…
Reference in a new issue