X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=bin%2Fmocksetup;h=f972aab2fdadd8806a86e7f91a3ce6a162504266;hb=dc3afbf1633090347f5f807332407aa0ac3245a5;hp=e811d2031f791d50a548a5d771af0f0b5e563bd8;hpb=25ae89b485e98ae8ebe9fb06692742959dacf45a;p=nethome.git diff --git a/bin/mocksetup b/bin/mocksetup index e811d20..f972aab 100755 --- a/bin/mocksetup +++ b/bin/mocksetup @@ -37,7 +37,10 @@ for r in $l;do fi echo >&2 -n "Locking $rpath/MOCK.mocksetup-lock ..." - lockfile -l 10 $rpath/MOCK.mocksetup-lock + if ! lockfile -1 -r 1 -s 1 $rpath/MOCK.mocksetup-lock;then + rm -f $rpath/MOCK.mocksetup-lock + lockfile -1 -r 1 -s 1 $rpath/MOCK.mocksetup-lock + fi echo >&2 " done" if $soft && [ -f $rpath/MOCK ];then @@ -79,33 +82,83 @@ for r in $l;do echo $c; $c fi + cmp -s /etc/resolv.conf $rpath/etc/resolv.conf \ + || cp -p /etc/resolv.conf $rpath/etc/resolv.conf + dir="/dev/pts" c="umount $rpath$dir" - while $c 2>&1|grep -v ': not mounted$';do + if $c 2>&1|grep -v ': not \(mounted\|found\)$';then echo $c - done + fi - for dir in /home /usr/local/bin /dev /proc /sys /root;do - c="umount $rpath$dir" - while $c 2>&1|grep -v ': not mounted$';do - echo $c - done - if ! $u;then - c="mount --bind $dir $rpath$dir" - echo $c; $c - fi - done + dir="/dev/shm" + c="umount $rpath$dir" + if $c 2>&1|grep -v ': not \(mounted\|found\)$';then + echo $c + fi - dir="/dev/pts" + test -e $rpath/dev/pts && (rmdir $rpath/dev/pts || :) if ! $u;then - c="mount --bind $dir $rpath$dir" - echo $c; $c + mkdir -p $rpath/dev/pts + fi + test -e $rpath/dev/shm && (rmdir $rpath/dev/shm || :) + if ! $u;then + mkdir -p $rpath/dev/shm + fi + rm -f $rpath/dev/null + if ! $u;then + mknod -m 666 $rpath/dev/null c 1 3 + fi + rm -f $rpath/dev/full + if ! $u;then + mknod -m 666 $rpath/dev/full c 1 7 + fi + rm -f $rpath/dev/zero + if ! $u;then + mknod -m 666 $rpath/dev/zero c 1 5 + fi + rm -f $rpath/dev/random + if ! $u;then + mknod -m 666 $rpath/dev/random c 1 8 + fi + rm -f $rpath/dev/urandom + if ! $u;then + mknod -m 444 $rpath/dev/urandom c 1 9 + fi + rm -f $rpath/dev/tty + if ! $u;then + mknod -m 666 $rpath/dev/tty c 5 0 + fi + rm -f $rpath/dev/console + if ! $u;then + mknod -m 600 $rpath/dev/console c 5 1 + fi + rm -f $rpath/dev/ptmx + if ! $u;then + mknod -m 666 $rpath/dev/ptmx c 5 2 + fi + rm -f $rpath/dev/stdin + if ! $u;then + ln -s /proc/self/fd/0 $rpath/dev/stdin + fi + rm -f $rpath/dev/stdout + if ! $u;then + ln -s /proc/self/fd/1 $rpath/dev/stdout + fi + rm -f $rpath/dev/stderr + if ! $u;then + ln -s /proc/self/fd/2 $rpath/dev/stderr + fi + rm -f $rpath/dev/fd + if ! $u;then + ln -s /proc/self/fd $rpath/dev/fd fi + # Must be before umount of /hdd c="umount $rpath/var/cache/yum" - while $c 2>&1|grep -v ': not mounted$';do + if $c 2>&1|grep -v ': not \(mounted\|found\)$';then echo $c - done + fi if ! $u;then if [ -d /var/cache/mock/$r/yum_cache ];then cr=$r @@ -116,6 +169,25 @@ for r in $l;do echo $c; $c fi + mkdir -p $rpath/unsafe $rpath/hdd + for dir in /home /usr/local/bin /proc /sys /root /unsafe /hdd;do + c="umount $rpath$dir" + if $c 2>&1|grep -v ': not \(mounted\|found\)$';then + echo $c + fi + if ! $u;then + c="mount --bind $dir $rpath$dir" + echo $c; $c + fi + done + + if ! $u;then + c="mount -t tmpfs mock_shmfs $rpath/dev/shm" + echo $c; $c + c="mount -t devpts -o mode=620,gid=5 mock_devpts $rpath/dev/pts" + echo $c; $c + fi + rm -f $rpath/usr/local/lib/debug if ! $u;then ln -s ../../lib/debug $rpath/usr/local/lib/debug @@ -135,8 +207,8 @@ for r in $l;do # Old systems incl. RHEL-6 do not feature it. if [ -d $rpath/etc/sudoers.d ];then rm -f $rpath/etc/sudoers.d/inteltest - if ! $u;then - ln /etc/sudoers.d/inteltest $rpath/etc/sudoers.d/inteltest + if ! $u;then : +# ln /etc/sudoers.d/inteltest $rpath/etc/sudoers.d/inteltest fi fi