/usr/share/dell/scripts/upgrade-fish-package.py is in dell-recovery 1.31.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/usr/bin/python3
# A helper script to upgrade an existing FISH package to new format (2012+)
import atexit
import tempfile
import tarfile
import argparse
import os.path
import lsb_release
from Dell.recovery_common import walk_cleanup
from Dell.recovery_xml import BTOxml
import sys
parser = argparse.ArgumentParser()
parser.add_argument('fname', nargs='?')
parser_args = parser.parse_args()
if not parser_args.fname or not os.path.exists(parser_args.fname):
print("Call this script with the path to an existing FISH package as an input")
sys.exit(1)
if parser_args.fname.endswith('.fish.tar.gz'):
print ("This is likely already upgraded, please provide a package that doesn't end in .fish.tar.gz")
sys.exit(1)
description = raw_input("Enter a description for this FISH package.\n")
#extract old FISH package
package_dir = tempfile.mkdtemp()
atexit.register(walk_cleanup, package_dir)
rfd = tarfile.open(parser_args.fname)
rfd.extractall(package_dir)
xml_file = os.path.join(package_dir, 'prepackage.dell')
#write XML object
xml_obj = BTOxml()
if os.path.exists(xml_file):
xml_obj.load_bto_xml(xml_file)
xml_obj.replace_node_contents('os', lsb_release.get_lsb_information()['RELEASE'])
xml_obj.append_fish('driver', description, 'n/a')
xml_obj.write_xml(xml_file)
#repack FISH package
output_dirname = os.path.dirname(parser_args.fname)
output_fname = parser_args.fname.split('.tar.gz')[0].split('.tgz')[0] + '.fish.tar.gz'
wfd = tarfile.open(output_fname, 'w:gz')
for obj in os.listdir(package_dir):
wfd.add(os.path.join(package_dir, obj), obj)
print ("Wrote updated FISH package to %s") % output_fname
print ("File contents:")
wfd.list()
wfd.close()
|