Skip to content

Instantly share code, notes, and snippets.

@ericfrederich
Created June 30, 2014 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericfrederich/d5029d2dd4bf84551485 to your computer and use it in GitHub Desktop.
Save ericfrederich/d5029d2dd4bf84551485 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from cleantar import single_prefix
import sys
import os
import time
single, msg = single_prefix(sys.argv[1])
if single:
print 'tar file is clean; just one prefix; will untar',; sys.stdout.flush()
for i in range(5, 0, -1):
print i,; sys.stdout.flush()
time.sleep(1)
os.execv('/bin/tar', ['/bin/tar', '-xvf', sys.argv[1]])
print "SHOULDN'T GET HERE"
sys.exit(1)
else:
print msg
print '... will not untar'
print 'if you really want to untar, run this...'
print 'tar -xvf "%s"' % sys.argv[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment