Hi Raf, Thanks a lot for your help. Now I’ve updated it regarding to your great advices. Would you mind to take a look again?
https://gist.github.com/siegfried/907904752b1b5db760782f476f44fca4 Sincerely yours, Siegfried zhiqiang....@gmail.com > On Apr 20, 2020, at 5:40 AM, Raf Czlonka <rczlo...@gmail.com> wrote: > > On Sun, Apr 19, 2020 at 08:30:11AM BST, Zhi-Qiang Lei wrote: >> Hi, >> >> I wrote a script to create chroot jails. Please feel free to use and >> comment. Thanks. >> >> https://gist.github.com/siegfried/907904752b1b5db760782f476f44fca4 >> > > Hi Zhi-Qiang, > > Please test *before* you post! > > Where are $JAIL_HOME and $IMAGE_HOME coming from? > > You aren't checking for $1 at all. > > Why the "example" in mktemp? > > Where do the iso files come from? > > You use "/bin/sh" but also "function" - bad style IMO. > > You aren't checking vnd0 is currently in use or not - please consider > something like this: > > vnd_dev="$(/sbin/vnconfig -l | awk '/not in use/,FS=":" { print $1 ; > exit }')" > > Apart from the MAKEDEV step, you can avoid using cd. > > /usr/lib is a built-in system directory so there's no need to pass > it to ldconfig. > > Not an issue here but *not* using '{}' around variable name inside > a string, will bite you in the arse one day! ;^) > > Regards, > > Raf