More issues came up which required some more modifications:
Code:
--- lxc-slackware.orig 2020-01-01 22:22:21.504770334 +0100
+++ lxc-slackware.new 2020-01-01 22:29:30.263410113 +0100
@@ -90,25 +90,48 @@
# http://www.vislab.uq.edu.au/howto/lxc/MAKEDEV.sh
DEV=$rootfs/dev
mkdir -p ${DEV}
+
+# some install scripts may redirect stderr to /dev/null
+# if /dev/null does not exist then this will lead to an error
+[[ -e ${DEV}/null ]] && rm -rf ${DEV}/null
mknod -m 666 ${DEV}/null c 1 3
+[[ -e ${DEV}/zero ]] && rm -rf ${DEV}/zero
mknod -m 666 ${DEV}/zero c 1 5
+[[ -e ${DEV}/random ]] && rm -rf ${DEV}/random
mknod -m 666 ${DEV}/random c 1 8
+[[ -e ${DEV}/urandom ]] && rm -rf ${DEV}/urandom
mknod -m 666 ${DEV}/urandom c 1 9
+[[ -e ${DEV}/pts ]] && rm -rf ${DEV}/pts
mkdir -m 755 ${DEV}/pts
+[[ -e ${DEV}/shm ]] && rm -rf ${DEV}/shm
mkdir -m 1777 ${DEV}/shm
+[[ -e ${DEV}/tty ]] && rm -rf ${DEV}/tty
mknod -m 666 ${DEV}/tty c 5 0
+[[ -e ${DEV}/console ]] && rm -rf ${DEV}/console
mknod -m 600 ${DEV}/console c 5 1
+[[ -e ${DEV}/tty0 ]] && rm -rf ${DEV}/tty0
mknod -m 666 ${DEV}/tty0 c 4 0
+[[ -e ${DEV}/tty1 ]] && rm -rf ${DEV}/tty1
mknod -m 666 ${DEV}/tty1 c 4 1
+[[ -e ${DEV}/tty2 ]] && rm -rf ${DEV}/tty2
mknod -m 666 ${DEV}/tty2 c 4 2
+[[ -e ${DEV}/tty3 ]] && rm -rf ${DEV}/tty3
mknod -m 666 ${DEV}/tty3 c 4 3
+[[ -e ${DEV}/tty4 ]] && rm -rf ${DEV}/tty4
mknod -m 666 ${DEV}/tty4 c 4 4
+[[ -e ${DEV}/tty5 ]] && rm -rf ${DEV}/tty5
mknod -m 666 ${DEV}/tty5 c 4 5
+[[ -e ${DEV}/full ]] && rm -rf ${DEV}/full
mknod -m 666 ${DEV}/full c 1 7
+[[ -e ${DEV}/initctl ]] && rm -rf ${DEV}/initctl
mknod -m 600 ${DEV}/initctl p
+[[ -e ${DEV}/loop0 ]] && rm -rf ${DEV}/loop0
mknod -m 660 ${DEV}/loop0 b 7 0
+[[ -e ${DEV}/loop1 ]] && rm -rf ${DEV}/loop1
mknod -m 660 ${DEV}/loop1 b 7 1
+[[ -e ${DEV}/ptmx ]] && rm -rf ${DEV}/ptmx
ln -s pts/ptmx ${DEV}/ptmx
+[[ -e ${DEV}/fd ]] && rm -rf ${DEV}/fd
ln -s /proc/self/fd ${DEV}/fd
echo "Adding an etc/fstab that must be modified later with the"
@@ -123,11 +146,11 @@
# Back up the existing init scripts and install the lxc versions:
( cd $rootfs/etc/rc.d
- cp -a /usr/share/lxc/scripts/slackware/* .
- chmod 755 *.lxc
- for file in *.lxc ; do
- cp -a $(basename $file .lxc) $(basename $file .lxc).orig
- cp -a $file $(basename $file .lxc)
+ for file in /usr/share/lxc/scripts/slackware/*.lxc ; do
+ base=$(basename $file .lxc)
+ cp -a $base $base.orig
+ cp -a $file $base
+ chmod 755 $base
done
)
A few more files (e.g. dev/zero) were created by the install scripts causing errors when mknod or ln was called. As a precaution I changed the script to check and delete any file if it already exists.
Another issue was that originally the script would first copy all *.lxc files into /etc/rc.d and then erroneously assume that every file that has an *.lxc suffix is a replacement for another "regular" script. This, however, is not true for rc.lxc where .lxc is not a suffix indicating a replacement script. The original script would strip this suffix and then try to execute
The patch addresses this issue, too, by deriving the basenames from /usr/share/lxc/scripts/slackware instead of from within $rootfs/etc/rc.d after they are copied.
|