On Thu, 1 Oct 2020 09:29:45 -0400
Scott Andrews via blfs-support
<[email protected]> wrote:

> In a clean install of LFS-9.0 in an overlayfs and no other packages
> installed
> 
> rm -rf /etc/init.d
> 
> mv /etc/rc.d/init.d /etc
> 
> rm -rf rc.d
> 
> install -vdm
> 0755 /etc/rc.d/{rc0.d,rc1.d,rc2.d,rc3.d,rc4.d,rc5.d,rc6.d,rcS.d}
> 
> list='halt mountvirtfs localnet udev checkfs mountfs console cleanfs
> modules sysklogd swap network reboot sendsignals sysctl udev_retry'
> 
> for i in ${list};do install_initd ${i};done
> 
> Traceback (most recent call last):
>   File "/usr/sbin/install_initd", line 297, in <module>
>     increment = 100 // len(sysinit)
> ZeroDivisionError: integer division or modulo by zero
> 
> If you run for i in ${list};do install_initd ${i};done
> a second time then there is no 
> ZeroDivisionError: integer division or modulo by zero

This patch I made from the git repo fixes the issue

diff --git a/lsbtools/install_initd.py b/lsbtools/install_initd.py
index ca3d38e..a6849d0 100644
--- a/lsbtools/install_initd.py
+++ b/lsbtools/install_initd.py
@@ -323,7 +323,10 @@ for s in sysinit:
       print("Removing", glob.glob(spath)[0])
     if dryrun == 0:
       os.remove(glob.glob(spath)[0])
-increment = 100 // len(sysinit)
+if len(sysinit) > 0:
+  increment = 100 // len(sysinit)
+else:
+  increment = 99
 sid = 0
 for s in sysinit:
   sname = s[hindex["name"]]
diff --git a/lsbtools/install_initd.py b/lsbtools/install_initd.py
index ca3d38e..a6849d0 100644
--- a/lsbtools/install_initd.py
+++ b/lsbtools/install_initd.py
@@ -323,7 +323,10 @@ for s in sysinit:
       print("Removing", glob.glob(spath)[0])
     if dryrun == 0:
       os.remove(glob.glob(spath)[0])
-increment = 100 // len(sysinit)
+if len(sysinit) > 0:
+  increment = 100 // len(sysinit)
+else:
+  increment = 99
 sid = 0
 for s in sysinit:
   sname = s[hindex["name"]]
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to