mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
dockersetup: support importing gzip compressed database dumps
Database dumps are simply SQL (i.e. plain text) so they tend to be both large and easy to compress, so having them gzipped is something worth supporting. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
841124a662
commit
24dcd4618a
|
@ -519,9 +519,14 @@ if not updatemode:
|
|||
|
||||
# Import the user's supplied data
|
||||
if dbfile:
|
||||
return_code = subprocess.call("gunzip -t %s > /dev/null 2>&1" % dbfile, shell=True)
|
||||
if return_code == 0:
|
||||
catcmd = 'zcat'
|
||||
else:
|
||||
catcmd = 'cat'
|
||||
env = os.environ.copy()
|
||||
env['MYSQL_PWD'] = dbapassword
|
||||
return_code = subprocess.call("docker exec -i -e MYSQL_PWD layersdb mysql -uroot layersdb < " + dbfile, shell=True, env=env)
|
||||
return_code = subprocess.call("%s %s | docker exec -i -e MYSQL_PWD layersdb mysql -uroot layersdb" % (catcmd, dbfile), shell=True, env=env)
|
||||
if return_code != 0:
|
||||
print("Database import failed")
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user