WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Compare restored backup files against original files  (Read 3572 times)

Offline ixbrian

  • Retired Admins
  • Sr. Member
  • *****
  • Posts: 436
Compare restored backup files against original files
« on: September 02, 2010, 10:40:47 PM »
I have made some changes to filetool.sh that are activated if you boot with a "comparerestore" bootcode.  The system boots normally and your files are restored from backup, however if a file is being restored from your backup that exists in the base system, the base system file is first renamed to filename.orig_file.    So once booted, you will be able to see both the live copy (that was restored from backup) and the original Tiny Core copy (which will end in a .orig_file file extension).   This is only activated when you boot with "comparerestore", and if you reboot again without this code all of the .orig_file files will be gone.  

I think this will be useful for when new versions of Tiny Core are released and there are files that are listed as "Likely in your backup" in the release notes.   You can boot with this comparerestore boot code and easily compare your backup files against the new Tiny Core version of the file and make any updates as needed.  It will also be helpful for general troubleshooting and understanding what files your backup is overwriting from the base system.  

All that needs to be added to filetool.sh to enable this is the following code (diff output between this and the Tiny Core 3.1 RC3 filetool.sh)  In order to try this out you would need to remaster Tiny Core with the new filetool.sh file.  

Code: [Select]
--- filetool.sh
+++ filetool.sh_original
@@ -157,14 +157,6 @@
      echo -n "decrypting .. "
      blowfish "$TARGETFILE"
   fi
-  if grep -q "comparerestore" /proc/cmdline && [ ! -e /etc/sysconfig/comparerestore ]; then
-    for file in `busybox tar -tzf $MOUNTPOINT/"$FULLPATH"/mydata.tgz`; do
-      if [ -f "/${file}" ]; then
-        sudo mv "/${file}" "/${file}.orig_file"
-      fi
-    done
-    sudo touch /etc/sysconfig/comparerestore
-  fi
   if [ "$PROMPT" ]; then
     sudo busybox tar -C / -zxvf $MOUNTPOINT/"$FULLPATH"/mydata.tgz
     echo -n "Press enter to continue:" ; read ans

You also must add the line below to /opt/.xfiletool.lst to prevent the .orig_file files from being added to your backup

Code: [Select]
*.orig_file
« Last Edit: September 14, 2010, 11:20:02 PM by ixbrian »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Unified diffs please (diff -u), the default is not really readable nor does it apply well after upstream changes.
Forum spacing might also break things, so attach a file if not sure.
The only barriers that can stop you are the ones you create yourself.

Offline ixbrian

  • Retired Admins
  • Sr. Member
  • *****
  • Posts: 436
Unified diffs please (diff -u), the default is not really readable nor does it apply well after upstream changes.
Forum spacing might also break things, so attach a file if not sure.

My original post has been updated with a unified diff both in the post and also attached as a file.  

Thanks,
Brian
« Last Edit: September 03, 2010, 06:16:15 PM by ixbrian »

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Compare restored backup files against original files
« Reply #3 on: September 17, 2010, 07:50:03 AM »
Accepted into base.
10+ Years Contributing to Linux Open Source Projects.