#!/bin/bash
readonly PACKAGE_SHORT_NAME="pyACL"
readonly RUN_DIR_NAME="run_package"
readonly PACKAGE_ARCH=$(arch)
PACKAGE_NAME="Ascend-pyACL"
INSTALL_DIRECTORY="pyACL"
CANN_TYPE=""
BASE_PACKAGE_VERSION=""
PACKAGE_VERSION=""
if [ "$CANN_TYPE" = "patch" ]; then
PACKAGE_NAME="Ascend-spc_pyACL"
INSTALL_DIRECTORY="spc/backup/pyACL/pyACL"
spc_path="spc"
cur_ver=""
spc_install_path=""
rollback_flag=n
fi
DEFAULT_INSTALL_PATH=""
username=$(id -nu)
usergroup=$(id -ng)
python_path="python"
share_info_dir="share/info"
lib_path="${PACKAGE_ARCH}-linux/lib64"
install_path=""
install_flag=n
uninstall_flag=n
upgrade_flag=n
input_path_flag=n
devel_flag=n
quiet_flag=n
install_for_all_flag=n
install_path_cmd="--install-path"
install_cmd=""
uninstall_path_cmd="--uninstall"
upgrade_path_cmd="--upgrade"
spc_python_per=""
spc_site_package_per=""
spc_install_per=""
acl_per=""
ver_per=""
if [ "$UID" = "0" ]; then
install_for_all_flag=y
DEFAULT_INSTALL_PATH="/usr/local/Ascend"
else
DEFAULT_INSTALL_PATH="${HOME}/Ascend"
fi
if [ $(id -u) -ne 0 ]; then
log_dir="${HOME}/var/log/ascend_seclog"
else
log_dir="/var/log/ascend_seclog"
fi
log_file="${log_dir}/ascend_install.log"
function print_usage() {
echo "Please use this option for more help: --help / -h"
exit 1
}
function print_error(){
print "ERROR" "Unsupported parameters : $1"
print_usage
}
create_folder() {
if [ ! -d "$log_dir" ]; then
mkdir -p $log_dir
fi
}
function log() {
local cur_date_=$(date +"%Y-%m-%d %H:%M:%S")
local log_type_=$1
local msg_=$2
local log_format_="[pyACL] [$cur_date_] [$log_type_]: ${msg_}"
if [ ! -f "$log_file" -a "$quiet_flag" = n ]; then
echo $log_format_
elif [ -f "$log_file" ]; then
echo $log_format_ >>$log_file
fi
}
function print() {
if [ "$quiet_flag" = y -a "$1" = "INFO" ]; then
log "$1" "$2"
return
fi
if [ ! -f "$log_file" ]; then
echo "[pyACL] [$(date +"%Y-%m-%d %H:%M:%S")] [$1] $2"
else
echo "[pyACL] [$(date +"%Y-%m-%d %H:%M:%S")] [$1] $2" | tee -a $log_file
fi
}
function file_check() {
if [ -f "$1" ]; then
return 0
else
return 1
fi
}
function mkdir_dir() {
if [ ! -d "$1" ]; then
mkdir -p $1
if [ $? -ne 0 ]; then
print "ERROR" "mkdir install path $1 permission denied"
exit 1
fi
print "INFO" "mkdir install path $1 successfully"
fi
if [ "$install_for_all_flag" = n ]; then
chmod 750 $1 2>/dev/null
else
chmod 755 $1 2>/dev/null
fi
}
function get_ver() {
local ver
ver=`grep Version $1 | cut -d '=' -f 2`
if [ $? != 0 ]; then
print "ERROR" "grep the version.info fail"
exit 1
fi
echo $ver
}
function cp_file() {
cp -f $1 $2
if [ $? = 0 ]; then
print "INFO" "copy $3 to $2 successfully"
else
print "ERROR" "copy $3 to $2 fail"
exit 1
fi
}
function get_sub_ver() {
num=`echo $1 | awk -F"." '{print NF-1}'`
local sub_ver=""
if [ $num -eq 3 ];then
sub_ver=${1##*.}
fi
echo $sub_ver
}
function sub_ver_comp() {
local py_ver=$1
local spc_ver=$2
if [ "$py_ver" = "$spc_ver" ];then
print "ERROR" "The version of the spc package is the same as the pyacl, install spc fail"
exit 1
fi
if ([ -n "$py_ver" ] && [ -n "$spc_ver" ] && [ "$py_ver" \> "$spc_ver" ]) || ([ -n "$py_ver" ] && [ -z "$spc_ver" ]); then
print "ERROR" "The spc sub version is inconsistent with the pyacl sub version, install spc fail"
exit 1
fi
}
function rm_file_safe() {
local file_path=$1
if [ -n "${file_path}" ]; then
if [ -f "${file_path}" ] || [ -h "${file_path}" ]; then
rm -f "${file_path}"
print "INFO" "delete file ${file_path} successfully"
else
print "WARNING" "the file is not exist"
fi
else
print "WARNING" "the file path is NULL"
fi
}
function rm_dir_safe() {
local dir_path=$1
if [ -n "${dir_path}" ] && [[ ! "${dir_path}" =~ ^/+$ ]]; then
if [ -d "${dir_path}" ]; then
rm -rf "${dir_path}"
print "INFO" "delete directory ${dir_path} successfully"
else
print "WARNING" "the directory is not exist"
fi
else
print "WARNING" "the directory path is NULL"
fi
}
chmod_recur() {
if [ "$3" = "dir" ]; then
find $1 -type d -exec chmod $2 {} \; 2> /dev/null
elif [ "$3" = "file" ]; then
find $1 -type f -exec chmod $2 {} \; 2> /dev/null
fi
}
function mod_dir_permis() {
chmod 500 -R ${spc_path}/script/pyACL/rollback.sh
chmod 500 -R ${spc_path}/script/pyACL/uninstall.sh
chmod 500 -R ${spc_path}/script/pyACL/rollback_precheck.sh
chmod 550 ${spc_path}/script/pyACL
chmod 550 -R ${spc_path}/backup/pyACL
chmod $ver_per ${spc_path}/backup/pyACL/pyACL/version.info
chmod 500 ${spc_path}/script/uninstall.sh
chmod 500 ${spc_path}/script/rollback.sh
chown -R $username:$usergroup ${spc_path}/script/pyACL
chown -R $username:$usergroup ${spc_path}/backup/pyACL
chmod $spc_python_per "${spc_path}/backup/pyACL/python"
chmod $spc_site_package_per "${spc_path}/backup/pyACL/python/site-packages"
chmod $spc_install_per "${spc_path}/backup/pyACL/pyACL"
chmod $spc_install_per "${install_path}/pyACL"
chmod $acl_per "${spc_path}/backup/pyACL/python/site-packages/acl.so"
}
chmod_after_install() {
if [ "$install_for_all_flag" = n ]; then
chmod 750 $install_path/python 2> /dev/null
chmod 750 $install_path/python/site-packages 2> /dev/null
chmod 750 $install_path/python/site-packages/acl 2> /dev/null
chmod 750 -R $acl_path
chmod 550 $install_path/${share_info_dir}/pyACL/script
chmod 500 $install_path/${share_info_dir}/pyACL/script/uninstall.sh
chmod 440 $install_path/python/site-packages/acl.so
chmod 440 $config_file_path 2> /dev/null
chmod 440 $version_file_path 2> /dev/null
chmod 440 $scene_file_path 2> /dev/null
chown -R $username:$usergroup $install_path/${share_info_dir}/pyACL
chown $username:$usergroup $install_path/python/site-packages/acl.so
chmod 550 $install_path/${share_info_dir}/pyACL 2> /dev/null
chmod 440 $install_path/${PACKAGE_ARCH}-linux/lib64/libjemalloc.so
else
chmod 755 $install_path/python 2> /dev/null
chmod 755 $install_path/python/site-packages 2> /dev/null
chmod 755 $install_path/python/site-packages/acl 2> /dev/null
chmod 755 -R $acl_path
chmod 555 $install_path/${share_info_dir}/pyACL 2> /dev/null
chmod 555 $install_path/${share_info_dir}/pyACL/script
chmod 500 $install_path/${share_info_dir}/pyACL/script/uninstall.sh
chmod 444 $install_path/python/site-packages/acl.so
chmod 444 $config_file_path 2> /dev/null
chmod 444 $version_file_path 2> /dev/null
chmod 444 $scene_file_path 2> /dev/null
chown -R $username:$usergroup $install_path/${share_info_dir}/pyACL
chown $username:$usergroup $install_path/python/site-packages/acl.so
chmod 444 $install_path/${PACKAGE_ARCH}-linux/lib64/libjemalloc.so
fi
if [ "$UID" = "0" ]; then
chmod 755 $install_path
fi
}
function parse_script_args() {
while true; do
case "$3" in
--check)
exit 0
;;
--help | -h)
print_usage
;;
--version)
echo "${PACKAGE_SHORT_NAME} ${PACKAGE_VERSION}"
exit 0
;;
--install)
if [ "$CANN_TYPE" = "patch" ]; then
print_error "$3"
fi
install_flag=y
shift
;;
--install-path=*)
local temp_path=$(echo $3 | cut -d"=" -f2 | sed "s/\/*$//g")
if [[ "${temp_path}" =~ ^/.* ]]; then
install_path=${temp_path}
else
print "ERROR" "parameter error $3, must absolute path"
exit 1
fi
input_path_flag=y
shift
;;
--uninstall)
uninstall_flag=y
shift
;;
--devel)
if [ "$CANN_TYPE" = "patch" ]; then
print_error "$3"
fi
devel_flag=y
shift
;;
--upgrade)
if [ "$CANN_TYPE" = "patch" ]; then
print_error "$3"
fi
upgrade_flag=y
shift
;;
--quiet)
quiet_flag=y
shift
;;
--rollback)
if [ "$CANN_TYPE" != "patch" ]; then
print_error "$3"
fi
rollback_flag=y
shift
;;
--run)
if [ "$CANN_TYPE" = "patch" ]; then
print_error "$3"
fi
install_flag=y
shift
;;
--full)
install_flag=y
shift
;;
--install-for-all)
if [ "$CANN_TYPE" = "patch" ]; then
print_error "$3"
fi
install_for_all_flag=y
shift
;;
-*)
print_error "$3"
;;
*)
break
;;
esac
done
}
function check_script_args() {
if [ $# -lt 3 ]; then
print_usage
fi
local args_num=0
if [ "$uninstall_flag" = y ]; then
let 'args_num+=1'
fi
if [ "$upgrade_flag" = y ]; then
let 'args_num+=1'
fi
if [ "$devel_flag" = y ]; then
let 'args_num+=1'
fi
if [ "$install_flag" = y ]; then
let 'args_num+=1'
fi
if [ "$rollback_flag" = y ]; then
let 'args_num+=1'
fi
if [ $args_num -lt 1 ] || [ $args_num -gt 1 ]; then
print "ERROR" "Unsupported parameters, operation failed."
exit 1
fi
if [ "$input_path_flag" = y ]; then
if [ "${rollback_flag}" = "n" ] && [ "${uninstall_flag}" = "n" ] && [ "$install_flag" = "n" ] && [ "$upgrade_flag" = "n" ] && [ "${devel_flag}" = "n" ]; then
print "ERROR" "Unsupported separate 'install-path' used independently"
exit 1
fi
fi
}
function complete_params() {
local tmp_install_path=${DEFAULT_INSTALL_PATH}
if [ "$input_path_flag" = "y" ]; then
tmp_install_path=${install_path}
fi
python_path=${tmp_install_path}/${python_path}
lib_path=${tmp_install_path}/${lib_path}
install_path="${tmp_install_path}"
config_file_path="${install_path}/${share_info_dir}/pyACL/ascend-${PACKAGE_SHORT_NAME}_install.info"
version_file_path="${install_path}/${share_info_dir}/pyACL/version.info"
scene_file_path="${install_path}/${share_info_dir}/pyACL/scene.info"
}
function log_init() {
if [ ! -f "$log_file" ]; then
touch $log_file
if [ $? -ne 0 ]; then
print "ERROR" "touch $log_file permission denied"
exit 1
fi
fi
chmod 640 $log_file
if [ "${install_flag}" = y ]; then
print "INFO" "install start"
elif [ "${uninstall_flag}" = y ]; then
print "INFO" "uninstall start"
elif [ "${upgrade_flag}" = y ]; then
print "INFO" "upgrade start"
elif [ "${rollback_flag}" = y ]; then
print "INFO" "rollback start"
fi
}
function check_version() {
local tmp_str=$(echo "${BASE_PACKAGE_VERSION} 1.0.0" | tr " " "\n" | sort -V | head -n 1)
if [ x"${tmp_str}" != x1.0.0 ]; then
print "ERROR" "package version too low"
print "ERROR" "check the environment failed"
exit 2
fi
return 0
}
function deal_install() {
if [ "${install_flag}" = y ] || [ "${devel_flag}" = y ] || [ "${upgrade_flag}" = y ]; then
mkdir_dir "$install_path"
fi
mkdir_dir "${install_path}/${share_info_dir}/pyACL"
chmod 750 -R "${install_path}/${share_info_dir}/pyACL"
mkdir_dir "${install_path}/${share_info_dir}/pyACL/script"
mkdir_dir "${python_path}"
mkdir_dir "${python_path}/site-packages"
acl_path=$python_path/site-packages/acl
mkdir_dir "${acl_path}"
cp -af "python/site-packages/acl.so" "${python_path}/site-packages/"
cp -af "script/uninstall.sh" "${install_path}/${share_info_dir}/pyACL/script"
if [ "${acl_path}/acl.so" ]; then
rm -f ${acl_path}/acl.so
fi
ln -sf ../acl.so ${acl_path}/acl.so
CURRENT_VERSION=$BASE_PACKAGE_VERSION
}
function deal_uninstall() {
${install_path}/${share_info_dir}/pyACL/script/uninstall.sh
}
function remove_cann_uninstall() {
if [ -f "${install_path}/cann_uninstall.sh" ]; then
sed -i "/uninstall_package \"share\/info\/pyACL\/script\"/d" "${install_path}/cann_uninstall.sh"
if [ $? -ne 0 ]; then
print "ERROR" "remove ${install_path}/cann_uninstall.sh uninstall_package command failed"
exit 2
fi
fi
}
function write_cann_uninstall() {
chmod 500 "${install_path}/cann_uninstall.sh"
chmod u+w "${install_path}/cann_uninstall.sh"
(grep "${share_info_dir}/pyACL/script" "${install_path}/cann_uninstall.sh") &> /dev/null
if [ $? -eq 0 ]; then
remove_cann_uninstall
fi
sed -i "/^exit /i uninstall_package \"share/info/pyACL/script\"" "${install_path}/cann_uninstall.sh"
chmod 500 "${install_path}/cann_uninstall.sh"
}
function regist_uninstall() {
if [ -f "${install_path}/cann_uninstall.sh" ]; then
write_cann_uninstall
else
cp -af script/cann_uninstall.sh ${install_path}
write_cann_uninstall
fi
}
function upgrade_uninstall() {
if [ -L "${install_path}/${share_info_dir}/pyACL" ]; then
pyACL_path=$(readlink -f ${install_path}/${share_info_dir}/pyACL)
${pyACL_path}/script/uninstall.sh ${upgrade_flag}
fi
}
function deal_jemalloc_install() {
local change_flag=n
if [ ! -w "$lib_path" ];then
chmod u+w $lib_path
change_flag=y
fi
cp_file "python/site-packages/libjemalloc.so" "$lib_path" "libjemalloc.so"
if [ "$change_flag" = "y" ];then
chmod u-w $lib_path
fi
}
function deal_with_packages() {
if [ "$1" == "install" ]; then
deal_install
deal_jemalloc_install
echo "Please make sure that
- PYTHONPATH includes ${python_path}/site-packages"
upgrade_config_file "install"
chmod_after_install
regist_uninstall
elif [ "$1" == "uninstall" ]; then
deal_uninstall
elif [ "$1" == "upgrade" ]; then
upgrade_uninstall
deal_install
deal_jemalloc_install
upgrade_config_file "upgrade"
chmod_after_install
regist_uninstall
fi
print "INFO" "${PACKAGE_NAME}-${BASE_PACKAGE_VERSION} ${1} success"
exit 0
}
function upgrade_config_file_spc() {
if [ "$1" == "install" ]; then
log "INFO" "version=${PACKAGE_VERSION}"
log "INFO" "arch=${PACKAGE_ARCH}"
fi
}
function upgrade_config_file() {
if [ "$1" == "install" ] || [ "$1" == "upgrade" ]; then
echo "Version=${BASE_PACKAGE_VERSION}" >${version_file_path}
log "INFO" "version=${BASE_PACKAGE_VERSION}"
echo "path=${install_path}" >${config_file_path}
log "INFO" "path=${install_path}"
echo "arch=${PACKAGE_ARCH}" >>${config_file_path}
log "INFO" "arch=${PACKAGE_ARCH}"
echo "pyacl_username=${username}" >>${config_file_path}
echo "pyacl_usergroup=${usergroup}" >>${config_file_path}
echo "os=linux" >${scene_file_path}
echo "arch=${PACKAGE_ARCH}" >>${scene_file_path}
log "INFO" "arch=${PACKAGE_ARCH}"
fi
}
function install_process() {
check_version
deal_with_packages "install"
}
function reinstall_check() {
if [ -L "${install_path}/${share_info_dir}/pyACL" ]; then
return 0
else
return 1
fi
}
function upgrade_process() {
reinstall_check
if [ $? -eq 1 ]; then
print "ERROR" "run package is not installed, upgrade failed"
print "ERROR" "check the environment failed"
exit 2
fi
check_version
deal_with_packages "upgrade"
}
function uninstall_check() {
if [ -d "${install_path}/${share_info_dir}/pyACL" ]; then
return 0
else
return 1
fi
}
function uninstall_process() {
uninstall_check
if [ $? -eq 1 ]; then
print "ERROR" "run package is not installed, uninstall failed"
print "ERROR" "check the environment failed"
exit 2
fi
deal_with_packages "uninstall"
}
function deal_install_spc() {
spc_install_per=`stat -c %a "${install_path}/pyACL"`
chmod 750 ${install_path}/pyACL
file_check "${install_path}/pyACL/ascend-${PACKAGE_SHORT_NAME}_install.info"
if [ $? -eq 1 ]; then
print "ERROR" "pyACL package is not installed, spc install failed"
print "ERROR" "check the environment failed"
exit 2
fi
if [ ! -d "$install_path/pyACL" ]; then
print "ERROR" "pyACL path not exist, spc install failed"
exit 1
fi
mkdir_dir "$spc_path"
sub_script=$spc_path/script/
sub_backup=$spc_path/backup
mkdir_dir "$sub_script"
mkdir_dir "$sub_backup"
if [ -f "${install_path}/pyACL/version.info" ]; then
ver_per==`stat -c %a "${install_path}/pyACL/version.info"`
pyacl_sub_ver=`grep Version "${install_path}/pyACL/version.info" | cut -d '=' -f 2`
pyacl_sub_ver=`get_sub_ver "$pyacl_sub_ver"`
spc_sub_ver=`get_sub_ver "$PACKAGE_VERSION"`
pyacl_ver=`echo $cur_ver | cut -d '.' -f 1,2,3`
pkg_ver=`echo $PACKAGE_VERSION | cut -d '.' -f 1,2,3`
if [ "$pyacl_ver" != ${pkg_ver} ];
then
print "ERROR" "The spc version is inconsistent with the pyacl version, install spc fail"
exit 1
fi
sub_ver_comp "$pyacl_sub_ver" "$spc_sub_ver"
mkdir_dir "$spc_install_path"
if [ -f "$spc_install_path/version.info" ]; then
chmod 750 $spc_install_path/version.info
fi
cp_file "${install_path}/pyACL/version.info" "$spc_install_path/" "version.info"
sed -i '/^Version=/c'Version=$PACKAGE_VERSION'' ${install_path}/pyACL/version.info
if [ $? = 0 ]; then
print "INFO" "Update the version successfully"
else
print "ERROR" "Update the version fail"
exit 1
fi
else
print "WARNING" "the file ${install_path}/pyACL/version.info is not exist"
exit 0
fi
python_path=${install_path}/python
acl_path=$python_path/site-packages
spc_python_path=$spc_path/backup/pyACL/python/site-packages
spc_python_per=`stat -c %a "${python_path}"`
spc_site_package_per=`stat -c %a "${acl_path}"`
mkdir_dir "$spc_python_path"
if [ -f "$spc_python_path/acl.so" ]; then
chmod 750 $spc_python_path/acl.so
fi
if [ -f "${acl_path}/acl.so" ]; then
cp_file "$acl_path/acl.so" "$spc_python_path" "acl.so"
else
print "ERROR" "the file ${acl_path}/acl.so is not exist, backup acl.so fail"
exit 2
fi
acl_per=`stat -c %a "${acl_path}/acl.so"`
cp_file "python/site-packages/acl.so" "$acl_path/" "acl.so"
chmod $acl_per "${acl_path}/acl.so"
mkdir_dir "${spc_path}/script/pyACL"
file_check "${spc_path}/script/uninstall.sh"
if [ $? -eq 1 ]; then
cp_file "script/uninstall.sh" "${spc_path}/script/" "uninstall.sh"
fi
file_check "${spc_path}/script/rollback.sh"
if [ $? -eq 1 ]; then
cp_file "script/rollback.sh" "${spc_path}/script/" "rollback.sh"
fi
chmod 750 "${spc_path}/script/pyACL"
cp_file "script/pyACL/uninstall.sh" "${spc_path}/script/pyACL" "uninstall.sh"
cp_file "script/pyACL/rollback.sh" "${spc_path}/script/pyACL" "rollback.sh"
cp_file "script/pyACL/rollback_precheck.sh" "${spc_path}/script/pyACL" "rollback_precheck.sh"
print "INFO" "${PACKAGE_NAME}-${PACKAGE_VERSION} install success"
}
function deal_uninstall_spc() {
file_check "${spc_path}/script/uninstall.sh"
if [ $? -eq 1 ]; then
print "ERROR" "The file uninstall.sh does not exist"
exit 2
fi
${spc_path}/script/uninstall.sh
}
function deal_rollback() {
file_check "${spc_path}/script/pyACL/rollback.sh"
if [ $? -eq 1 ]; then
print "ERROR" "The file rollback.sh does not exist"
exit 2
fi
${spc_path}/script/pyACL/rollback.sh
}
function get_current_version() {
if [ -d "${install_path}/pyACL" ]; then
if [ -f "${install_path}/pyACL/version.info" ]; then
cur_ver=`get_ver "${install_path}/pyACL/version.info"`
else
print "WARNING" "the file ${install_path}/pyACL/version.info is not exist"
exit 0
fi
else
print "WARNING" "the dir ${install_path}/pyACL is not exist"
exit 0
fi
}
function set_spc_path() {
local tmp_install_path=${DEFAULT_INSTALL_PATH}
if [ "$input_path_flag" = "y" ]; then
tmp_install_path=${install_path}
fi
spc_path=${tmp_install_path}/${BASE_PACKAGE_VERSION}/${spc_path}
spc_install_path=${tmp_install_path}/${BASE_PACKAGE_VERSION}/${INSTALL_DIRECTORY}
install_path=${tmp_install_path}/${BASE_PACKAGE_VERSION}
}
function process_spc() {
set_spc_path
if [ "$uninstall_flag" = "y" ]; then
deal_uninstall_spc
fi
get_current_version
if [ "$install_flag" = "y" ]; then
deal_install_spc
echo "Please make sure that
- PYTHONPATH includes ${python_path}/site-packages"
upgrade_config_file_spc "install"
mod_dir_permis
elif [ "$rollback_flag" = "y" ]; then
deal_rollback
fi
exit 0
}
function process() {
if [ "$install_flag" = "y" ] || [ "${devel_flag}" = "y" ]; then
install_process
elif [ "$upgrade_flag" = "y" ]; then
upgrade_process
elif [ "$uninstall_flag" = "y" ]; then
uninstall_process
fi
}
function create_install_dir() {
local install_path="$1"
if [ -d "${install_path}" ]; then
return
fi
local tmp_install_path="$1"
while [ ! -d $(dirname ${tmp_install_path}) ]; do
tmp_install_path=$(dirname ${tmp_install_path})
done
mkdir -p ${install_path}
if [ $? -ne 0 ]; then
print "ERROR" "mkdir insatll path ${install_path} permission denied"
exit 1
fi
if [ "$UID" != "0" ] && [ "$install_for_all_flag" = n ]; then
chmod -R 750 ${tmp_install_path}
else
chmod -R 755 ${tmp_install_path}
fi
}
function main() {
umask 0022
create_folder
parse_script_args $*
check_script_args $*
if [ "$input_path_flag" = n ]; then
create_install_dir "${DEFAULT_INSTALL_PATH}"
else
create_install_dir "${install_path}"
fi
log_init
if [ "$CANN_TYPE" = "patch" ]; then
process_spc
else
complete_params
process
fi
}
main $*