1#!/bin/bash 2# Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd 3# This file contains confidential and proprietary information of 4# OSWare Technology Co., Ltd 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18set -e 19 20function readfile () 21{ 22 for file in $1/* 23 do 24 if [ -d "$file" ];then 25 readfile $file $2 $3 26 elif [ "$file" -nt "$2" ]; then 27 echo $file is update 28 touch $3; 29 return 30 fi 31 done 32} 33 34echo $1 for check kernel dir 35echo $2 for output image 36echo $3 for timestamp 37if [ -e "$2" ]; then 38 readfile $1 $2 $3 39 if [ "$3" -nt "$2" ]; then 40 echo "need update $2" 41 rm -rf $2; 42 fi 43fi 44 45