#!/bin/bash

if [[ -f ./patch_flag ]];then
    echo "shim patched!"
    exit 0
fi

tar -zxvf shim-*.tar.gz
cp -fr ./shim-*/* ./
rm -rf ./shim-*
cat ./series.conf | while read line
do
    if [[ $line == '' || $line =~ ^\s*# ]]; then
        continue
    fi
    echo "====patch $line======"
    pwd
    patch -p1 -F1 -s < ./patches/$line
done

touch ./patch_flag
