#!/bin/bash

if ! [ -d ./qmapshack ]; then
	mkdir qmapshack
fi

if [ -e ./dem.os ]; then
	unsquashfs -f -d qmapshack/dem dem.os
fi

if [ -e ./routino.os ]; then
	unsquashfs -f -d qmapshack/routino routino.os
fi

if [ -e ./west.os ]; then
	unsquashfs -f -d qmapshack/maps west.os
fi

if [ -e ./sud.os ]; then
	unsquashfs -f -d qmapshack/maps1 sud.os
	mv ./qmapshack/maps1/* ./qmapshack/maps
	rmdir ./qmapshack/maps1
fi

if [ -e ./middle.os ]; then
	unsquashfs -f -d qmapshack/maps1 middle.os
	mv ./qmapshack/maps1/* ./qmapshack/maps
	rmdir ./qmapshack/maps1
fi

if [ -e ./north.os ]; then
	unsquashfs -f -d qmapshack/maps1 north.os
	mv ./qmapshack/maps1/* ./qmapshack/maps
	rmdir ./qmapshack/maps1
fi

chown -R archivista.archivista ./qmapshack



