diff --git a/imagesync.sh b/imagesync.sh index 7db7802..c8262cc 100755 --- a/imagesync.sh +++ b/imagesync.sh @@ -115,9 +115,33 @@ aria2c --allow-overwrite --check-integrity --seed-time=0 --summary-interval=0 -- rm dht.dat print_done -print_waiting "Extracting root filesystem image" -tar xzf rootfs.tar.gz -print_done +print_waiting "Comparing installed and remote image" +if [ -f /tmp_root/.build_uuid ];then + cd /tmp + tar xzf /tmp_root/rootfs.tar.gz .build_uuid + if [ $(cat .build_uuid) == $(cat /tmp_root/.build_uuid) ];then + sync=false + else + sync=true + print_done + print_waiting "Deleting old filesystem" + cd /tmp_root + rm -rf $(tar tzf rootfs.tar.gz|grep '^[^/]*/$' ) + cd /tmp + print_done + fi + rm .build_uuid + cd /tmp_root +else + sync=true + print_done +fi + +if [ $sync == "true" ];then + print_waiting "Extracting root filesystem image" + tar xzf rootfs.tar.gz + print_done +fi ## # UNMOUNT TEMPORARY ROOTFS