Newer
Older
# vim: set shiftwidth=4 softtabstop=4:
# Create archive of project sources
# Arguments:
# - directory of the odoo sources
# - name of the tar file (the target file will have this name + .xz) if no name specified, name is <project name>.tar
odoo_dir=$1
tar_file=${2-${project_name}.tar}
odoo_modules="$(read_odoo_scripts_expandable_configuration_key modules " ")"
dependencies="$(read_odoo_scripts_expandable_configuration_key dependencies " ")"

Vincent Hatakeyama
committed
cd "$project_home" || exit 1

Vincent Hatakeyama
committed
tar cf "${project_name}.tar" --files-from /dev/null
# Add modules, in odoo_modules directory (whatever the original directory name)

Vincent Hatakeyama
committed
for module in $(eval echo "$odoo_modules") ;
tar uf "$tar_file" --dereference --transform="s|^$(dirname "${module[2,-1]}")|odoo_modules|" --show-transform --exclude-vcs --exclude-backups --exclude='*.pyc' --exclude='.drone.yml' --exclude='.gitlab-ci.yml' --atime-preserve "${module}"
done
# Add dependencies, in dependencies directory (whatever the original directory name)

Vincent Hatakeyama
committed
for dep in $(eval echo "$dependencies") ;
tar uf "$tar_file" --dereference --transform="s|^$(dirname "$dep")|dependencies|" --exclude-vcs --exclude-backups --exclude='*.pyc' --exclude='.drone.yml' --exclude='.gitlab-ci.yml' --atime-preserve "$dep"
done
# Add version number file if present

Vincent Hatakeyama
committed
if [ -f VERSION ];
tar uf "$tar_file" --atime-preserve VERSION

Vincent Hatakeyama
committed
if [ -d "$odoo_dir" ];
tar uf "$tar_file" --dereference --transform="s|^$(echo "$odoo_dir" | sed -e 's|/\(.*\)|\1|')|odoo|" --exclude-vcs --exclude-backups --exclude='*.pyc' --atime-preserve "$odoo_dir"

Vincent Hatakeyama
committed
xz "$tar_file"
echo $INFO Tar file $tar_file.xz created