1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16set -e 17 18function readfile () 19{ 20 for file in $1/* 21 do 22 if [ -d "$file" ];then 23 readfile $file $2 $3 24 elif [ "$file" -nt "$2" ]; then 25 echo $file is update 26 touch $3; 27 return 28 fi 29 done 30} 31 32echo $1 for check kernel dir 33echo $2 for output image 34echo $3 for timestamp 35if [ -e "$2" ]; then 36 readfile $1 $2 $3 37 if [ "$3" -nt "$2" ]; then 38 echo "need update $2" 39 rm -rf $2; 40 fi 41fi 42 43