These codes will be found in /usr/lib/catalyst2/targets/support/rc-update.sh It's intend is to remove runlevel in which have no regular file,but there may be some link files in it. So we cannot use command rmdir but rm -rf CONTENTS=$(find /etc/runlevels/${x} -type f) if [ -z "${CONTENTS}" ] then echo "${x}: Empty runlevel found.... deleting" rmdir "/etc/runlevels/${x}" fi
I have forgot to give the exact line number of these words. They are lying in the last 10 lines of rc-update.sh
I really do appreciate your finding these bugs. Is there a chance I could get you to start provising patches instead? It makes things much easier. cp filename filename.orig edit filename (fix bug) diff -uN filename.orig filename > filename.patch This way there's no confusion on what you think should/needs to be changed. Also, if there are symlinks in the runlevel, we shouldn't be removing it, so I think instead the CONTENTS variable needs adjustment to look for both files *and* symlinks. Wouldn't you agree?
A better solution is probably to check for symlinks instead of files with 'find /etc/runlevels/${x} -type l'. If the runlevel is one of the default ones provided by baselayout, it will probably have a .keep file in it. While it's unlikely that the boot or default runlevels will ever be empty, it's still probably a good idea to make sure that /etc/runlevels/${x}/.keep doesn't exist before removing the directory and bail out (non-fatally, of course) if it does exist.
yeah,I think you are right. I was just wondering if deleting runlevel in which have no regular files, maybe there will no runlevel left because most of files in runlevel are links. And I promise that I will use patch next time to make things easier.^^
No problem, Alvin. =] Anyway, I think instead I'm going to remove all of the code for runlevel removal, since there's not really much point in it and the runlevels need to be present for the installer anyway, even if they are empty.
Fixed in 2.0_rc43 and above.