0

When I ship a new version of linux, I zip it up and email it to my customer. They then unzip it with tar and overwrite the filesystem.

However this is not ideal as there may be files lingering from an older install and so I cant be certain they will have the same filesytem state as I have, after the install.

So I would like to delete the entire filesystem before writing the new one. But of course this will not work as then the 'tar' command will not be able to run.

So could anyone suggest a list of directories I could remove so I can remove as much as possible to get as close as possible to a clean install?

(There might be alternatives to this scheme which I will ask about in another question). Note, it is an embedded sealed product on an internal network. So no Internet, but they can SSH into it, but not remove the sdcard.

closed as off-topic by lenik, joan, Ghanima, Milliways, RPiAwesomeness Feb 6 '15 at 0:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – lenik, joan, Ghanima, Milliways, RPiAwesomeness
If this question can be reworded to fit the rules in the help center, please edit the question.

  • The usual way of accomplishing this is to boot to a mini system image which modifies a main image temporarily mounted somewhere other than "/". On a pi you might just use a second sdcard, and put the one to be updated in a USB adapter. You should however be able to do something with early boot scripts to have a main and repair image on the same card, but it may be tricky. You could also use a small VM on a pc for this. But you are probably better off with a second card that can serve either as an upgrade tool or a backup should the prime one become corrupted. – Chris Stratton Jan 27 '15 at 15:11
  • This would really fit better on Unix & Linux, as it's more of a Linux issue than a Raspberry Pi-specific one. – RPiAwesomeness Feb 6 '15 at 0:26
4

I think that your process is highly flawed in the first place. I'd rather:

  1. create an image of you new installation
  2. write a new sd-card with it
  3. exchange cards

Deleting stuff on a running system is never a good idea.

Alternatives

You would need to create a process which compares all files on the local system:

  1. find / -xdev |sort
  2. tar -vf myarchive.tar|sort
  3. diff the output
  4. remove all files form the running system that are not in the tar-archive

OR:

Create proper packages and install those....

  • 1
    +1 For use proper packages, this is exactly why the packaging systems were created. – Craig Jan 27 '15 at 15:42
  • +1 For @Craig (who didn't actually upvote). Also I agree that the OP is approaching this the wrong way and should re-think. – goldilocks Jan 27 '15 at 15:55
  • Packages are good, as @Craig suggests. However, it still isn't a guarantee for "have the same filesytem state as I have". – Ronny Nilsson Jan 27 '15 at 17:32
  • We cant exchange sdcards as it is sealed and my company dont want to finance the dev costs of more complicated schemes. I have implemented your clever diff scheme. Thanks. – spiderplant0 Jan 28 '15 at 0:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.