
2 Mar
2021
2 Mar
'21
9:25 p.m.
On Tue, Mar 02, 2021 at 09:13:41AM +0800, Luan Shengde wrote:
@@ -0,0 +1,48 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. /lib/dracut-lib.sh + +# transfer LKP dirs +[ -d /lkp ] || return 0 + +cp -a /lkp "$NEWROOT"/ + +for i in /lkp/lkp/src/rootfs/addon/* /usr/local/* /opt/* +do + dir=$(basename "$i") + + [ "$i" != "${i%/\*}" ] && continue # skip: i='dir/*'
it's a little puzzling for the test style, why do you use "${i%/\*}" for you have use command 'basename'. do you want to check if it's a dir? you can use: [ -d "$i" ] || continue dir=$(basename "$i")
Thanks, Luan Shengde
Good, it's used to skip when i is just a empty dir, I'll modify to make it more clear for readers. Thanks for remiding. Thanks, Xijian