This commit is contained in:
Marc Beninca 2024-11-13 11:34:59 +01:00
parent 39fdabd885
commit a6e63a6722
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
4 changed files with 17 additions and 21 deletions

View file

@ -6,21 +6,21 @@ ps1() {
local path="${PWD}" local path="${PWD}"
local user="${USER}" local user="${USER}"
local view="└ " local view="└ "
if [ ${code} -ne 0 ] ; then if [ ${code} -ne 0 ]; then
view="${view}\e[0;31m" view="${view}\e[0;31m"
else else
view="${view}\e[0;32m" view="${view}\e[0;32m"
fi fi
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
if [ "$(type -t __git_ps1)" == "function" ] ; then if [ "$(type -t __git_ps1)" == "function" ]; then
git="$(__git_ps1)" git="$(__git_ps1)"
if [ "${git}" ] ; then if [ "${git}" ]; then
view="${view} –\e[0;35m${git}\e[0m" view="${view} –\e[0;35m${git}\e[0m"
fi fi
fi fi
view="${view}\n\e[0;36m${path}\e[0m" view="${view}\n\e[0;36m${path}\e[0m"
view="${view}\n┌ " view="${view}\n┌ "
if [ ${EUID} -eq 0 ] ; then if [ ${EUID} -eq 0 ]; then
view="${view}\e[0;31m" view="${view}\e[0;31m"
else else
view="${view}\e[0;32m" view="${view}\e[0;32m"

View file

@ -1,7 +1,7 @@
mrc() { mrc() {
local container="${1}" local container="${1}"
local f local f
for f in "dev" "dev/pts" "proc" "sys" ; do for f in "dev" "dev/pts" "proc" "sys"; do
mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}"
done done
} }
@ -15,12 +15,11 @@ crc() {
urc() { urc() {
local container="${1}" local container="${1}"
local f local f
for f in "sys" "proc" "dev/pts" "dev" ; do for f in "sys" "proc" "dev/pts" "dev"; do
umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}"
done done
} }
mmc() { mmc() {
local container="${1}" local container="${1}"
mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb"

View file

@ -1,13 +1,13 @@
mo() { mo() {
local directory="${1}" local directory="${1}"
local file local file
if [ -n "${directory}" ] ; then if [ -n "${directory}" ]; then
directory="$(realpath "${directory}")" directory="$(realpath "${directory}")"
file="${directory}/filesystem.squashfs" file="${directory}/filesystem.squashfs"
if mkdir "overlay" ; then if mkdir "overlay"; then
cd "overlay" cd "overlay"
mkdir {lower,upper,work,mount} mkdir {lower,upper,work,mount}
if mount "${file}" "lower" ; then if mount "${file}" "lower"; then
mount \ mount \
-o lowerdir="lower",upperdir="upper",workdir="work" \ -o lowerdir="lower",upperdir="upper",workdir="work" \
-t "overlay" \ -t "overlay" \
@ -22,10 +22,10 @@ mo() {
uo() { uo() {
cd "overlay" cd "overlay"
if umount "mount" ; then if umount "mount"; then
rmdir "mount" rmdir "mount"
rm --recursive "upper" "work" rm --recursive "upper" "work"
if umount "lower" ; then if umount "lower"; then
rmdir "lower" rmdir "lower"
fi fi
fi fi
@ -33,10 +33,9 @@ uo() {
rmdir "overlay" rmdir "overlay"
} }
mr() { mr() {
local f local f
for f in "dev" "dev/pts" "proc" "sys" ; do for f in "dev" "dev/pts" "proc" "sys"; do
mount --bind "/${f}" "overlay/mount/${f}" mount --bind "/${f}" "overlay/mount/${f}"
done done
} }
@ -54,12 +53,11 @@ chroot \
ur() { ur() {
local f local f
for f in "sys" "proc" "dev/pts" "dev" ; do for f in "sys" "proc" "dev/pts" "dev"; do
umount --lazy "overlay/mount/${f}" umount --lazy "overlay/mount/${f}"
done done
} }
mm() { mm() {
mount --make-rslave --rbind "/deb" "overlay/mount/deb" mount --make-rslave --rbind "/deb" "overlay/mount/deb"
} }
@ -68,12 +66,11 @@ um() {
umount --recursive "overlay/mount/deb" umount --recursive "overlay/mount/deb"
} }
ms() { ms() {
local directory="${1}" local directory="${1}"
local level="${2}" local level="${2}"
if [ -n "${directory}" ] ; then if [ -n "${directory}" ]; then
if mkdir "${directory}" ; then if mkdir "${directory}"; then
[ -n "${level}" ] || level="18" [ -n "${level}" ] || level="18"
cp overlay/mount/{vmlinuz,initrd.img} "${directory}" cp overlay/mount/{vmlinuz,initrd.img} "${directory}"
mksquashfs \ mksquashfs \