bash-utils/awesome-tasks/.odoo/install

81 lines
2.0 KiB
Plaintext
Raw Normal View History

2018-05-21 20:34:41 +02:00
#!/bin/bash
##
## Task odoo install v1.0
## Copyright (C) Thomas Di gregorio
## Licensed under MIT
##
## Copy a module or theme folder in the addons folder of an odoo instance (odoo-test by default).
##
## Usage:
## @script.name [ --in INSTANCE ] FOLDER
##
## Options:
## ( Long version are mandatory, and can be before or after short version )
##
## -h, --help Show this help.
## -v, --verbose Show sub-task resolution and options parsed.
## --in=INSTANCE Name the docker odoo instance to copy in.
##
## Exemples:
## install web_responsive
## install theme_backent_v11 --in manage
##
# wirte tour default options here
in="odoo-test"
source easyoptions || exit
verbose() { [[ -n "" ]] && echo /home/dig/bin/.taskrc; }
##### YOUR CODE HERE #####
sudo cp -r $1 /opt/docker/$in/addons/
verbose "Copied \'$1\' in folder: /opt/docker/$in/addons/"
##### SNIPPETS ##################################################################
# Boolean and parameter options
# [[ -n "$option" ]] && echo "Option specified: --option is $option"
# Arguments
#for argument in "${arguments[@]}"; do
# echo "Argument specified: $argument"
#done
# Verbose (echo only if -v or --verbose options
#verbose "I\'m doing things"
#mkdir "cant/create/this" || verbose "Error creating folder!"
# Auto called function acording to 1st agument
#command()
#{
# # here get 2nd argument with /home/dig/bin/.taskrc (local 1st arg) or (script)
#}
################################################################################
__dirname="$(dirname $0)"
__dirtask="$__dirname/.$(basename $0)"
2018-06-29 15:39:56 +02:00
# Calls command (1rt argument) as script or function $1( $2 $3 ... )
2018-05-21 20:34:41 +02:00
if [ -r "$__dirtask/$1" ]
2018-06-29 15:39:56 +02:00
verbose "Command file exists call it: $__dirtask/$1 ${*:2}"
$__dirtask/$1 ${*:2}
2018-05-21 20:34:41 +02:00
else
if [ -n "$(type -t $1)" ] && [ "$(type -t $1)" = function ];
then
2018-06-29 15:39:56 +02:00
verbose "$__dirtask/$1 not exists try func: $1 ${*:2}"
$1 "${*:2}"
2018-05-21 20:34:41 +02:00
fi
fi