Qual: Apply beautysh (#27395)

# Qual: Apply beautysh

Beautysh the shell scripts.
Also fixed some spelling.
This commit is contained in:
MDW 2024-01-10 19:47:29 +01:00 committed by GitHub
parent f0d910ecd3
commit 5d69728703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 803 additions and 803 deletions

View File

@ -48,7 +48,7 @@ echo "Ask for web server to setup"
db_input critical dolibarr/reconfigure-webserver || true
if db_go ; then
okcancel="1"
okcancel="1"
else
okcancel="0"
fi

View File

@ -19,25 +19,25 @@ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
fi
setup_empty_conf() {
echo Create empty file $config
mkdir -p /etc/dolibarr
touch /etc/dolibarr/conf.php
chown root:www-data /etc/dolibarr/conf.php
chmod 660 /etc/dolibarr/conf.php
echo Create empty file $config
mkdir -p /etc/dolibarr
touch /etc/dolibarr/conf.php
chown root:www-data /etc/dolibarr/conf.php
chmod 660 /etc/dolibarr/conf.php
}
is_new_upstream_version() {
# $1 can be empty (not installed) and will result in a true value
# for the check
old_version=$(echo "$1" | sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
new_version=$(dpkg-query -f '${Version}' -W dolibarr | \
sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
test "$old_version" != "$new_version"
# $1 can be empty (not installed) and will result in a true value
# for the check
old_version=$(echo "$1" | sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
new_version=$(dpkg-query -f '${Version}' -W dolibarr | \
sed -e 's/-[^-]*$//' -e 's/^[0-9]*://')
test "$old_version" != "$new_version"
}
enable_install_upgrade_wizard() {
echo Enable install wizard by removing install.lock file if present
rm -f /var/lib/dolibarr/documents/install.lock
rm -f /var/lib/dolibarr/documents/install.lock
}
@ -46,24 +46,24 @@ php_install() {
# php5endmod exists for ubuntu only
echo "Enable php module mysqli with php5enmod"
php5enmod mysqli
fi
fi
}
apache_install() {
webserver=$1
# Enable Apache 2 alias module
if which a2enmod >/dev/null 2>&1 ;then
echo "Enable apache module alias with a2enmod"
a2enmod alias
fi
# Enable dolibarr conf
if which a2enconf >/dev/null 2>&1 ;then
# a2enconf exists for ubuntu only
echo "Enable link for Apache config file with a2enconf"
a2enconf dolibarr
else
else
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
echo "Add link for Apache config file"
ln -s /etc/$webserver/conf-available/dolibarr.conf /etc/$webserver/conf.d/dolibarr.conf
@ -101,7 +101,7 @@ case "$1" in
configure)
if [ -z "$2" ]; then
echo First install
#setup_empty_conf
#setup_empty_conf
else
echo This is not a first install
fi
@ -109,17 +109,17 @@ case "$1" in
php_install
apache_install
lighttpd_install
# Remove lock file
if is_new_upstream_version "$2"; then
enable_install_upgrade_wizard
enable_install_upgrade_wizard
fi
# Create document directory for uploaded data files
mkdir -p $docdir
chown -R www-data:www-data $docdir
chmod -R 775 $docdir
chmod -R g+s $docdir
# Create document directory for uploaded data files
mkdir -p $docdir
chown -R www-data:www-data $docdir
chmod -R 775 $docdir
chmod -R g+s $docdir
# Copy install config file (with matching Debian values) into target directory
superuserlogin=''
@ -136,14 +136,14 @@ case "$1" in
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
fi
chown -R root:www-data $installconfig
chmod -R 660 $installconfig
chmod -R 660 $installconfig
# If a conf already exists and its content was already completed by installer
if [ ! -s $config ] || ! grep -q "File generated by" $config
then
# Create an empty conf.php with permission to web server
setup_empty_conf
#else
#else
# File already exist. We add params not found.
#echo Add new params to overwrite path to use shared libraries/fonts
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
@ -154,18 +154,18 @@ case "$1" in
#grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
#grep -q -c "dolibarr_js_JQUERY_UI" $config || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
#grep -q -c "dolibarr_js_JQUERY_FLOT" $config || [ ! -d "/usr/share/javascript/flot" ] || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
#grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
#grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config
fi
db_get dolibarr/reconfigure-webserver
webservers="$RET"
# Set up web server.
for webserver in $webservers ; do
webserver=${webserver%,}
echo Complete config of server $webserver
# Detect webuser and webgroup
webuser=
webgroup=
@ -181,7 +181,7 @@ case "$1" in
# Set permissions to web server
chown -R $webuser:$webgroup /usr/share/dolibarr
chown -R root:$webgroup $config
chown -R root:$webgroup $config
done
# Restart web server.
@ -193,33 +193,33 @@ case "$1" in
apache_install $webserver
fi
# Reload webserver in any case, configuration might have changed
# Redirection of 3 is needed because Debconf uses it and it might
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
echo Restart web server $server using invoke-rc.d
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
invoke-rc.d $webserver reload 3>/dev/null || true
else
echo Restart web server $server using $server reload
/etc/init.d/$webserver reload 3>/dev/null || true
fi
fi
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
echo Restart web server $server using invoke-rc.d
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
invoke-rc.d $webserver reload 3>/dev/null || true
else
echo Restart web server $server using $server reload
/etc/init.d/$webserver reload 3>/dev/null || true
fi
fi
done
echo ----------
echo "Call Dolibarr page http://localhost/dolibarr/ to complete the setup and use Dolibarr."
echo ----------
;;
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
;;
*)
echo "postinst called with unknown argument $1" >&2
exit 0
;;
;;
esac
#DEBHELPER#

View File

@ -30,8 +30,8 @@ lighttpd_remove() {
fi
# See bug #448682
if [ -h /etc/lighttpd/conf-enabled/50-dolibarr.conf ] ; then
echo "postrm Manually deleting lighttpd/dolibarr configuration link"
rm /etc/lighttpd/conf-enabled/50-dolibarr.conf
echo "postrm Manually deleting lighttpd/dolibarr configuration link"
rm /etc/lighttpd/conf-enabled/50-dolibarr.conf
fi
fi
}
@ -46,7 +46,7 @@ apache_remove() {
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
. /usr/share/debconf/confmodule
fi
db_version 2.0
@ -62,12 +62,12 @@ lockfile="$docdir/install.lock"
case "$1" in
# Call when we upgrade
# Call when we upgrade
upgrade)
echo "postrm upgrade"
;;
;;
# Call when we uninstall
# Call when we uninstall
remove)
echo "postrm remove"
rm -f $lockfile
@ -85,7 +85,7 @@ case "$1" in
else
apache_remove $webserver
fi
# Redirection of 3 is needed because Debconf uses it and it might
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
if [ -f /etc/init.d/$webserver ] ; then
if [ -x /usr/sbin/invoke-rc.d ]; then
@ -95,9 +95,9 @@ case "$1" in
fi
fi
done
;;
;;
# Call when we uninstall and purge
# Call when we uninstall and purge
purge)
echo "postrm purge"
@ -111,7 +111,7 @@ case "$1" in
set +e
db_get dolibarr/postrm
set -e
if [ "$RET" = "true" ] ; then
echo postrm Mysql database deletion
# Get database configuration
@ -131,7 +131,7 @@ case "$1" in
dbadmin="$superuserlogin"
dbadmpass="$superuserpassword"
dbtype="mysql"
# To delete a mysql user (disabled)
# Needs: $dbuser - the user name to create (or replace).
# $dballow - what hosts to allow (defaults to %).
@ -144,7 +144,7 @@ case "$1" in
# mysql
# /usr/share/wwwconfig-coomon/mysql.get
#. /usr/share/wwwconfig-common/${dbtype}-dropuser.sh
# To delete database
# Needs: $dbname - the database that user should have access to.
# $dbserver - the server to connect to.
@ -158,85 +158,85 @@ case "$1" in
# Define mysqlcmd
if [ -z "$dbserver" ] || [ "$dbserver" = "localhost" ]; then
hostopt=""
dbserver=localhost
dbserver=localhost
else
case "$dbserver" in
:*)
dbsocket=`echo $dbserver | sed -e 's/^://'`
hostopt="-S $dbsocket"
;;
*)
hostopt="-h $dbserver"
;;
esac
case "$dbserver" in
:*)
dbsocket=`echo $dbserver | sed -e 's/^://'`
hostopt="-S $dbsocket"
;;
*)
hostopt="-h $dbserver"
;;
esac
fi
if [ -z "$dbadmpass" ] ; then
log="${log}No password used."
passopt=""
log="${log}No password used."
passopt=""
else
passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
fi
mysqlcmd="mysql $hostopt $passopt -u $dbadmin"
mysqlcmdnopass="mysql $hostopt -u $dbadmin"
# Now run the drop user
# Now run the drop user
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then
echo postrm Database login $dbuser@localhost removed
else
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'localhost';\""
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'localhost';\""
echo postrm $error
fi
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then
echo postrm Database login $dbuser@% removed
else
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'%';\""
error="Unable to run $mysqlcmdnopass -f -e \"DROP USER '$dbuser'@'%';\""
echo postrm $error
fi
# Now run the drop commands
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
log="${log}Droping database $dbname."
# Now run the drop commands
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
log="${log}Dropping database $dbname."
if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully droped. You have to do it manually."
echo postrm $error
else
status=drop
fi
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
error="Database $dbname NOT successfully dropped. You have to do it manually."
echo postrm $error
else
status=drop
fi
else
error="Unable to run the drop database script."
error="Unable to run the drop database script."
echo postrm $error
fi
else
else
status=nothing
log="${log}Database $dbname already not exists."
fi
fi
echo "postrm Remove directory $docdir"
rm -rf $docdir ;
echo "postrm Remove directory $docdir"
rm -rf $docdir ;
else
echo "postrm Delete of dolibarr database and uploaded files not wanted"
echo "postrm Delete of dolibarr database and uploaded files not wanted"
fi
rm -rf /etc/dolibarr
# We clean variable (we ignore errors because db_reset can fails if var was never set)
set +e
set +e
db_reset dolibarr/reconfigure-webserver
db_reset dolibarr/postrm
set -e
set -e
#db_purge
;;
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
;;
*)
echo "postrm called with unknown argument $1" >&2
exit 0
;;
;;
esac
#DEBHELPER#

View File

@ -5,7 +5,7 @@ tmpdir=$(mktemp -d)
# Download source file
if [ -n "$1" ]; then
uscan_opts="--download-version=$1"
uscan_opts="--download-version=$1"
fi
#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Script used by the Dockerfile.
# See README.md to know how to create a Dolibarr env with docker
# See README.md to know how to create a Dolibarr env with docker
usermod -u ${HOST_USER_ID} www-data
groupmod -g ${HOST_USER_ID} www-data

View File

@ -1,4 +1,4 @@
#/bin/ksh
#!/bin/bash
#----------------------------------------------------------------------------
# \file build/patch/buildpatch.sh
# \brief Create patch files
@ -6,16 +6,16 @@
#----------------------------------------------------------------------------
# This script can be used to build a patch after a developer has made
# changes on files in its Dolibarr tree.
# The output patch file can then be submited on Dolibarr dev mailing-list,
# The output patch file can then be submitted on Dolibarr dev mailing-list,
# with explanation on its goal, for inclusion in main branch.
#----------------------------------------------------------------------------
echo ----- Building patch file mypatch.patch -----
if [ -z "$1" ] || [ -z "$2" ];
then
echo Usage: buildpatch.sh original_dir_path modified_dir_path
echo Example: buildpatch.sh /mydirA/dolibarrold /mydirB/dolibarrnew
then
echo Usage: buildpatch.sh original_dir_path modified_dir_path
echo Example: buildpatch.sh /mydirA/dolibarrold /mydirB/dolibarrnew
else
echo Build patch between \"$1\" and \"$2\"
diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents $1 $2 > mypatch.patch
echo Build patch between \"$1\" and \"$2\"
diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents $1 $2 > mypatch.patch
fi

View File

@ -9,7 +9,7 @@
# Regis Houssin - regis.houssin@inodbox.com
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: initdemo.sh confirm
# Usage: initdemo.sh confirm
# usage: initdemo.sh confirm mysqldump_dolibarr_x.x.x.sql database port login pass
#------------------------------------------------------
@ -17,7 +17,7 @@
export mydir=`echo "$0" | sed -e 's/initdemo.sh//'`;
if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ]
then
export mydir="."
export mydir="."
fi
export id=`id -u`;
@ -59,106 +59,106 @@ then
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
--inputbox "Input dump file :" 16 55 $dumpfile 2> $fichtemp
--inputbox "Input dump file :" 16 55 $dumpfile 2> $fichtemp
valret=$?
case $valret in
0)
dumpfile=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
dumpfile=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ----------------------------- database name
DIALOG=${DIALOG=dialog}
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
valret=$?
case $valret in
0)
base=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
base=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ---------------------------- database port
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
valret=$?
case $valret in
0)
port=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
port=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ---------------------------- compte admin mysql
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
--inputbox "Mysql user login (ex: root):" 16 55 root 2> $fichtemp
--inputbox "Mysql user login (ex: root):" 16 55 root 2> $fichtemp
valret=$?
case $valret in
0)
admin=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
admin=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ---------------------------- mot de passe admin mysql
# ---------------------------- password admin mysql (root)
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \
--passwordbox "Password for Mysql user login :" 16 55 2> $fichtemp
--passwordbox "Password for Mysql user login :" 16 55 2> $fichtemp
valret=$?
case $valret in
0)
passwd=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
passwd=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
# ---------------------------- confirmation
DIALOG=${DIALOG=dialog}
$DIALOG --title "Init Dolibarr with demo values" --clear \
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
case $? in
0) echo "Ok, start process...";;
1) exit;;
255) exit;;
0) echo "Ok, start process..." ;;
1) exit ;;
255) exit ;;
esac
fi
@ -180,7 +180,7 @@ export res=$?
if [ $res -ne 0 ]; then
echo "Error to load database dump with mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
exit
fi
fi
$mydir/updatedemo.php confirm
export res=$?
@ -190,32 +190,32 @@ export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_ma
if [ "x$documentdir" != "x" ]
then
$DIALOG --title "Reset document directory" --clear \
--inputbox "DELETE and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
--inputbox "DELETE and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
valret=$?
case $valret in
0)
rep=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
rep=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
echo "rep=$rep"
if [ "x$rep" = "xy" ]; then
echo rm -fr "$documentdir/*"
rm -fr $documentdir/*
fi
echo cp -pr $mydir/documents_demo/* "$documentdir/"
cp -pr $mydir/documents_demo/* "$documentdir/"
mkdir "$documentdir/doctemplates/" 2>/dev/null
echo cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
echo cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
@ -224,11 +224,11 @@ then
rm -f "$documentdir/doctemplates/"*/index.html
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
chmod -R u+w "$documentdir/"
chown -R www-data "$documentdir/"
else
echo Detection of documents directory from $mydir failed so demo files were not copied.
echo Detection of documents directory from $mydir failed so demo files were not copied.
fi

View File

@ -5,7 +5,7 @@
#
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: initdemopassword.sh confirm
# Usage: initdemopassword.sh confirm
# usage: initdemopassword.sh confirm base port login pass
#------------------------------------------------------
@ -13,7 +13,7 @@
export mydir=`echo "$0" | sed -e 's/initdemopassword.sh//'`;
if [ "x$mydir" = 'x' -o "x$mydir" = 'x./' ]
then
export mydir="."
export mydir="."
fi
export id=`id -u`;
@ -56,87 +56,87 @@ then
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Reset login password" --clear \
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
valret=$?
case $valret in
0)
base=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
base=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ---------------------------- database port
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Reset login password" --clear \
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
valret=$?
case $valret in
0)
port=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
port=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm $fichtemp
# ----------------------------- demo login
DIALOG=${DIALOG=dialog}
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Reset login password" --clear \
--inputbox "Login to reset :" 16 55 dolibarrdemologin 2> $fichtemp
--inputbox "Login to reset :" 16 55 dolibarrdemologin 2> $fichtemp
valret=$?
case $valret in
0)
demologin=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
demologin=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm fichtemp
# ----------------------------- demo pass
DIALOG=${DIALOG=dialog}
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Reset login password" --clear \
--inputbox "Pass to set :" 16 55 dolibarrdemopass 2> $fichtemp
--inputbox "Pass to set :" 16 55 dolibarrdemopass 2> $fichtemp
valret=$?
case $valret in
0)
demopass=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
demopass=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
rm fichtemp
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
# ---------------------------- confirmation
DIALOG=${DIALOG=dialog}
$DIALOG --title "Reset login password" --clear \
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
case $? in
0) echo "Ok, start process...";;
1) exit;;
255) exit;;
0) echo "Ok, start process..." ;;
1) exit ;;
255) exit ;;
esac
fi
@ -152,7 +152,7 @@ fi
if [ "x${demopasshash}" != "xpassword_hash" ]
then
echo '<?php echo MD5("'$demopass'"); ?>' > /tmp/tmp.php
echo '<?php echo MD5("'$demopass'"); ?>' > /tmp/tmp.php
newpass=`php -f /tmp/tmp.php`
else
echo '<?php echo password_hash("'$demopass'", PASSWORD_DEFAULT); ?>' > /tmp/tmp.php
@ -167,7 +167,7 @@ export res=$?
if [ $res -ne 0 ]; then
echo "Error to execute sql with mysql -P$port -u$admin -p***** $base"
exit
fi
fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it.
@ -175,7 +175,7 @@ if [ -s "$mydir/initdemopostsql.sql" ]; then
mysql -P$port $base < "$mydir/initdemopostsql.sql"
else
echo No file initdemopostsql.sql found, so no extra sql action done.
fi
fi
if [ "x$res" = "x0" ]

View File

@ -6,7 +6,7 @@
# Regis Houssin - regis.houssin@inodbox.com
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
# WARNING: This script erase setup of instance,
# WARNING: This script erase setup of instance,
# but not the database
#------------------------------------------------------
@ -14,7 +14,7 @@
export mydir=`echo "$0" | sed -e 's/removedemo.sh//'`;
if [ "x$mydir" = "x" ]
then
export mydir="./"
export mydir="./"
fi
export id=`id -u`;
@ -22,8 +22,8 @@ export id=`id -u`;
# ----------------------------- check if root
if [ "x$id" != "x0" -a "x$id" != "x1001" ]
then
echo "Script must be ran as root"
exit
echo "Script must be ran as root"
exit
fi
@ -32,15 +32,15 @@ DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Remove Dolibarr install" --clear \
--yesno "Do you confirm ?" 15 40
--yesno "Do you confirm ?" 15 40
valret=$?
case $valret in
0)
base=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
base=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ---------------------------- remove conf file

View File

@ -1,6 +1,6 @@
#!/bin/sh
#------------------------------------------------------
# Script to extrac a database with demo values.
# Script to extract a database with demo values.
# Note: "dialog" tool need to be available if no parameter provided.
#
# Regis Houssin - regis.houssin@inodbox.com
@ -14,7 +14,7 @@
export mydir=`echo "$0" | sed -e 's/savedemo.sh//'`;
if [ "x$mydir" = "x" ]
then
export mydir="."
export mydir="."
fi
export id=`id -u`;
@ -47,97 +47,97 @@ then
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \
--inputbox "Output dump file :" 16 55 $dumpfile 2> $fichtemp
--inputbox "Output dump file :" 16 55 $dumpfile 2> $fichtemp
valret=$?
case $valret in
0)
dumpfile=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
dumpfile=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ----------------------------- database name
DIALOG=${DIALOG=dialog}
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
valret=$?
case $valret in
0)
base=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
base=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ---------------------------- database port
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
valret=$?
case $valret in
0)
port=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
port=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ---------------------------- compte admin mysql
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \
--inputbox "Mysql root login (ex: root):" 16 55 root 2> $fichtemp
--inputbox "Mysql root login (ex: root):" 16 55 root 2> $fichtemp
valret=$?
case $valret in
0)
admin=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
admin=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ---------------------------- mot de passe admin mysql
# ---------------------------- Password for admin mysql (root)
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \
--passwordbox "Password for Mysql root login :" 16 55 2> $fichtemp
--passwordbox "Password for Mysql root login :" 16 55 2> $fichtemp
valret=$?
case $valret in
0)
passwd=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
0)
passwd=`cat $fichtemp` ;;
1)
exit ;;
255)
exit ;;
esac
# ---------------------------- chemin d'acces du repertoire documents
#DIALOG=${DIALOG=dialog}
#fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
#trap "rm -f $fichtemp" 0 1 2 5 15
#$DIALOG --title "Save Dolibarr with demo values" --clear \
# --inputbox "Full path to documents directory (ex: /var/www/dolibarr/documents)- no / at end :" 16 55 2> $fichtemp
# --inputbox "Full path to documents directory (ex: /var/www/dolibarr/documents)- no / at end :" 16 55 2> $fichtemp
#valret=$?
#case $valret in
# 0)
#docs=`cat $fichtemp`;;
@ -146,16 +146,16 @@ then
# 255)
#exit;;
#esac
# ---------------------------- confirmation
DIALOG=${DIALOG=dialog}
$DIALOG --title "Save Dolibarr with demo values" --clear \
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
case $? in
0) echo "Ok, start process...";;
1) exit;;
255) exit;;
0) echo "Ok, start process..." ;;
1) exit ;;
255) exit ;;
esac
fi
@ -167,180 +167,180 @@ then
export passwd="-p$passwd"
fi
export list="
--ignore-table=$base.llx_abonne
--ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_accountingaccount
--ignore-table=$base.llx_accountingsystem
--ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values
--ignore-table=$base.llx_agefodd_calendrier
--ignore-table=$base.llx_agefodd_certif_state
--ignore-table=$base.llx_agefodd_certificate_type
--ignore-table=$base.llx_agefodd_contact
--ignore-table=$base.llx_agefodd_convention
--ignore-table=$base.llx_agefodd_convention_stagiaire
--ignore-table=$base.llx_agefodd_cursus
--ignore-table=$base.llx_agefodd_cursus_extrafields
--ignore-table=$base.llx_agefodd_formateur
--ignore-table=$base.llx_agefodd_formateur_category
--ignore-table=$base.llx_agefodd_formateur_category_dict
--ignore-table=$base.llx_agefodd_formateur_training
--ignore-table=$base.llx_agefodd_formateur_type
--ignore-table=$base.llx_agefodd_formation_catalogue
--ignore-table=$base.llx_agefodd_formation_catalogue_extrafields
--ignore-table=$base.llx_agefodd_formation_catalogue_modules
--ignore-table=$base.llx_agefodd_formation_catalogue_type
--ignore-table=$base.llx_agefodd_formation_catalogue_type_bpf
--ignore-table=$base.llx_agefodd_formation_cursus
--ignore-table=$base.llx_agefodd_formation_objectifs_peda
--ignore-table=$base.llx_agefodd_opca
--ignore-table=$base.llx_agefodd_place
--ignore-table=$base.llx_agefodd_reg_interieur
--ignore-table=$base.llx_agefodd_session
--ignore-table=$base.llx_agefodd_session_adminsitu
--ignore-table=$base.llx_agefodd_session_admlevel
--ignore-table=$base.llx_agefodd_session_calendrier
--ignore-table=$base.llx_agefodd_session_commercial
--ignore-table=$base.llx_agefodd_session_contact
--ignore-table=$base.llx_agefodd_session_element
--ignore-table=$base.llx_agefodd_session_extrafields
--ignore-table=$base.llx_agefodd_session_formateur
--ignore-table=$base.llx_agefodd_session_formateur_calendrier
--ignore-table=$base.llx_agefodd_session_stagiaire
--ignore-table=$base.llx_agefodd_session_stagiaire_heures
--ignore-table=$base.llx_agefodd_session_status_type
--ignore-table=$base.llx_agefodd_stagiaire
--ignore-table=$base.llx_agefodd_stagiaire_certif
--ignore-table=$base.llx_agefodd_stagiaire_cursus
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
--ignore-table=$base.llx_agefodd_stagiaire_type
--ignore-table=$base.llx_agefodd_training_admlevel
--ignore-table=$base.llx_askpricesupplier
--ignore-table=$base.llx_askpricesupplier_extrafields
--ignore-table=$base.llx_askpricesupplierdet
--ignore-table=$base.llx_askpricesupplierdet_extrafields
--ignore-table=$base.llx_assetOf
--ignore-table=$base.llx_assetOf_line
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_product
--ignore-table=$base.llx_asset_workstation_task
--ignore-table=$base.llx_assetof_amounts
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_bookkeeping
--ignore-table=$base.llx_bootstrap
--ignore-table=$base.llx_bt_namemap
--ignore-table=$base.llx_bt_speedlimit
--ignore-table=$base.llx_bt_summary
--ignore-table=$base.llx_bt_timestamps
--ignore-table=$base.llx_bt_webseedfiles
--ignore-table=$base.llx_c_civilite
--ignore-table=$base.llx_c_dolicloud_plans
--ignore-table=$base.llx_c_pays
--ignore-table=$base.llx_c_source
--ignore-table=$base.llx_c_ticketsup_category
--ignore-table=$base.llx_c_ticketsup_severity
--ignore-table=$base.llx_c_ticketsup_type
--ignore-table=$base.llx_cabinetmed_c_banques
--ignore-table=$base.llx_cabinetmed_c_examconclusion
--ignore-table=$base.llx_cabinetmed_cons_extrafields
--ignore-table=$base.llx_cabinetmed_diaglec
--ignore-table=$base.llx_cabinetmed_examaut
--ignore-table=$base.llx_cabinetmed_exambio
--ignore-table=$base.llx_cabinetmed_examenprescrit
--ignore-table=$base.llx_cabinetmed_motifcons
--ignore-table=$base.llx_cabinetmed_patient
--ignore-table=$base.llx_cabinetmed_societe
--ignore-table=$base.llx_congespayes
--ignore-table=$base.llx_congespayes_config
--ignore-table=$base.llx_congespayes_events
--ignore-table=$base.llx_congespayes_logs
--ignore-table=$base.llx_congespayes_users
--ignore-table=$base.llx_dolicloud_customers
--ignore-table=$base.llx_dolicloud_stats
--ignore-table=$base.llx_dolicloud_emailstemplates
--ignore-table=$base.llx_dolireport_column
--ignore-table=$base.llx_dolireport_criteria
--ignore-table=$base.llx_dolireport_graph
--ignore-table=$base.llx_dolireport_plot
--ignore-table=$base.llx_dolireport_report
--ignore-table=$base.llx_domain
--ignore-table=$base.llx_ecommerce_category
--ignore-table=$base.llx_ecommerce_commande
--ignore-table=$base.llx_ecommerce_facture
--ignore-table=$base.llx_ecommerce_product
--ignore-table=$base.llx_ecommerce_site
--ignore-table=$base.llx_ecommerce_societe
--ignore-table=$base.llx_ecommerce_socpeople
--ignore-table=$base.llx_element_rang
--ignore-table=$base.llx_element_tag
--ignore-table=$base.llx_eleves
--ignore-table=$base.llx_eleves_extrafields
--ignore-table=$base.llx_entity
--ignore-table=$base.llx_entity_extrafields
--ignore-table=$base.llx_entity_thirdparty
--ignore-table=$base.llx_equipement_factory
--ignore-table=$base.llx_factory
--ignore-table=$base.llx_factory_extrafields
--ignore-table=$base.llx_factorydet
--ignore-table=$base.llx_filemanager_roots
--ignore-table=$base.llx_fournisseur_ca
--ignore-table=$base.llx_google_maps
--ignore-table=$base.llx_lead
--ignore-table=$base.llx_lead_extrafields
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_monitoring_probes
--ignore-table=$base.llx_m
--ignore-table=$base.llx_m_extrafields
--ignore-table=$base.llx_monmodule_abcdef
--ignore-table=$base.llx_notes
--ignore-table=$base.llx_packages
--ignore-table=$base.llx_packages_extrafields
--ignore-table=$base.llx_pos_cash
--ignore-table=$base.llx_pos_control_cash
--ignore-table=$base.llx_pos_facture
--ignore-table=$base.llx_pos_moviments
--ignore-table=$base.llx_pos_ticketdet
--ignore-table=$base.llx_pos_paiement_ticket
--ignore-table=$base.llx_pos_places
--ignore-table=$base.llx_pos_ticket
--ignore-table=$base.llx_printer_ipp
--ignore-table=$base.llx_publi_c_contact_list
--ignore-table=$base.llx_publi_c_dnd_list
--ignore-table=$base.llx_publi_c_method_list
--ignore-table=$base.llx_residence
--ignore-table=$base.llx_residence_building
--ignore-table=$base.llx_residence_building_links
--ignore-table=$base.llx_scaninvoices_filestoimport
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
--ignore-table=$base.llx_scaninvoices_settings
--ignore-table=$base.llx_scaninvoices_settings_extrafields
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
--ignore-table=$base.llx_sellyoursaas_blacklistdir
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
--ignore-table=$base.llx_sellyoursaas_blacklistip
--ignore-table=$base.llx_sellyoursaas_blacklistmail
--ignore-table=$base.llx_sellyoursaas_blacklistto
--ignore-table=$base.llx_sellyoursaas_deploymentserver
--ignore-table=$base.llx_sellyoursaas_stats
--ignore-table=$base.llx_sellyoursaas_whitelistip
--ignore-table=$base.llx_societe_rib2
--ignore-table=$base.llx_sellyoursaas_cancellation
--ignore-table=$base.llx_ticketsup
--ignore-table=$base.llx_ultimatepdf
--ignore-table=$base.llx_update_modules
--ignore-table=$base.llx_ventilation_achat
--ignore-table=$base.tmp_llx_accouting_account
--ignore-table=$base.tmp_llx_product_batch
--ignore-table=$base.tmp_llx_product_batch2
--ignore-table=$base.tmp_tmp
--ignore-table=$base.tmp_user
"
--ignore-table=$base.llx_abonne
--ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_accountingaccount
--ignore-table=$base.llx_accountingsystem
--ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values
--ignore-table=$base.llx_agefodd_calendrier
--ignore-table=$base.llx_agefodd_certif_state
--ignore-table=$base.llx_agefodd_certificate_type
--ignore-table=$base.llx_agefodd_contact
--ignore-table=$base.llx_agefodd_convention
--ignore-table=$base.llx_agefodd_convention_stagiaire
--ignore-table=$base.llx_agefodd_cursus
--ignore-table=$base.llx_agefodd_cursus_extrafields
--ignore-table=$base.llx_agefodd_formateur
--ignore-table=$base.llx_agefodd_formateur_category
--ignore-table=$base.llx_agefodd_formateur_category_dict
--ignore-table=$base.llx_agefodd_formateur_training
--ignore-table=$base.llx_agefodd_formateur_type
--ignore-table=$base.llx_agefodd_formation_catalogue
--ignore-table=$base.llx_agefodd_formation_catalogue_extrafields
--ignore-table=$base.llx_agefodd_formation_catalogue_modules
--ignore-table=$base.llx_agefodd_formation_catalogue_type
--ignore-table=$base.llx_agefodd_formation_catalogue_type_bpf
--ignore-table=$base.llx_agefodd_formation_cursus
--ignore-table=$base.llx_agefodd_formation_objectifs_peda
--ignore-table=$base.llx_agefodd_opca
--ignore-table=$base.llx_agefodd_place
--ignore-table=$base.llx_agefodd_reg_interieur
--ignore-table=$base.llx_agefodd_session
--ignore-table=$base.llx_agefodd_session_adminsitu
--ignore-table=$base.llx_agefodd_session_admlevel
--ignore-table=$base.llx_agefodd_session_calendrier
--ignore-table=$base.llx_agefodd_session_commercial
--ignore-table=$base.llx_agefodd_session_contact
--ignore-table=$base.llx_agefodd_session_element
--ignore-table=$base.llx_agefodd_session_extrafields
--ignore-table=$base.llx_agefodd_session_formateur
--ignore-table=$base.llx_agefodd_session_formateur_calendrier
--ignore-table=$base.llx_agefodd_session_stagiaire
--ignore-table=$base.llx_agefodd_session_stagiaire_heures
--ignore-table=$base.llx_agefodd_session_status_type
--ignore-table=$base.llx_agefodd_stagiaire
--ignore-table=$base.llx_agefodd_stagiaire_certif
--ignore-table=$base.llx_agefodd_stagiaire_cursus
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
--ignore-table=$base.llx_agefodd_stagiaire_type
--ignore-table=$base.llx_agefodd_training_admlevel
--ignore-table=$base.llx_askpricesupplier
--ignore-table=$base.llx_askpricesupplier_extrafields
--ignore-table=$base.llx_askpricesupplierdet
--ignore-table=$base.llx_askpricesupplierdet_extrafields
--ignore-table=$base.llx_assetOf
--ignore-table=$base.llx_assetOf_line
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_product
--ignore-table=$base.llx_asset_workstation_task
--ignore-table=$base.llx_assetof_amounts
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_asset_workstation_of
--ignore-table=$base.llx_bookkeeping
--ignore-table=$base.llx_bootstrap
--ignore-table=$base.llx_bt_namemap
--ignore-table=$base.llx_bt_speedlimit
--ignore-table=$base.llx_bt_summary
--ignore-table=$base.llx_bt_timestamps
--ignore-table=$base.llx_bt_webseedfiles
--ignore-table=$base.llx_c_civilite
--ignore-table=$base.llx_c_dolicloud_plans
--ignore-table=$base.llx_c_pays
--ignore-table=$base.llx_c_source
--ignore-table=$base.llx_c_ticketsup_category
--ignore-table=$base.llx_c_ticketsup_severity
--ignore-table=$base.llx_c_ticketsup_type
--ignore-table=$base.llx_cabinetmed_c_banques
--ignore-table=$base.llx_cabinetmed_c_examconclusion
--ignore-table=$base.llx_cabinetmed_cons_extrafields
--ignore-table=$base.llx_cabinetmed_diaglec
--ignore-table=$base.llx_cabinetmed_examaut
--ignore-table=$base.llx_cabinetmed_exambio
--ignore-table=$base.llx_cabinetmed_examenprescrit
--ignore-table=$base.llx_cabinetmed_motifcons
--ignore-table=$base.llx_cabinetmed_patient
--ignore-table=$base.llx_cabinetmed_societe
--ignore-table=$base.llx_congespayes
--ignore-table=$base.llx_congespayes_config
--ignore-table=$base.llx_congespayes_events
--ignore-table=$base.llx_congespayes_logs
--ignore-table=$base.llx_congespayes_users
--ignore-table=$base.llx_dolicloud_customers
--ignore-table=$base.llx_dolicloud_stats
--ignore-table=$base.llx_dolicloud_emailstemplates
--ignore-table=$base.llx_dolireport_column
--ignore-table=$base.llx_dolireport_criteria
--ignore-table=$base.llx_dolireport_graph
--ignore-table=$base.llx_dolireport_plot
--ignore-table=$base.llx_dolireport_report
--ignore-table=$base.llx_domain
--ignore-table=$base.llx_ecommerce_category
--ignore-table=$base.llx_ecommerce_commande
--ignore-table=$base.llx_ecommerce_facture
--ignore-table=$base.llx_ecommerce_product
--ignore-table=$base.llx_ecommerce_site
--ignore-table=$base.llx_ecommerce_societe
--ignore-table=$base.llx_ecommerce_socpeople
--ignore-table=$base.llx_element_rang
--ignore-table=$base.llx_element_tag
--ignore-table=$base.llx_eleves
--ignore-table=$base.llx_eleves_extrafields
--ignore-table=$base.llx_entity
--ignore-table=$base.llx_entity_extrafields
--ignore-table=$base.llx_entity_thirdparty
--ignore-table=$base.llx_equipement_factory
--ignore-table=$base.llx_factory
--ignore-table=$base.llx_factory_extrafields
--ignore-table=$base.llx_factorydet
--ignore-table=$base.llx_filemanager_roots
--ignore-table=$base.llx_fournisseur_ca
--ignore-table=$base.llx_google_maps
--ignore-table=$base.llx_lead
--ignore-table=$base.llx_lead_extrafields
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_monitoring_probes
--ignore-table=$base.llx_m
--ignore-table=$base.llx_m_extrafields
--ignore-table=$base.llx_monmodule_abcdef
--ignore-table=$base.llx_notes
--ignore-table=$base.llx_packages
--ignore-table=$base.llx_packages_extrafields
--ignore-table=$base.llx_pos_cash
--ignore-table=$base.llx_pos_control_cash
--ignore-table=$base.llx_pos_facture
--ignore-table=$base.llx_pos_moviments
--ignore-table=$base.llx_pos_ticketdet
--ignore-table=$base.llx_pos_paiement_ticket
--ignore-table=$base.llx_pos_places
--ignore-table=$base.llx_pos_ticket
--ignore-table=$base.llx_printer_ipp
--ignore-table=$base.llx_publi_c_contact_list
--ignore-table=$base.llx_publi_c_dnd_list
--ignore-table=$base.llx_publi_c_method_list
--ignore-table=$base.llx_residence
--ignore-table=$base.llx_residence_building
--ignore-table=$base.llx_residence_building_links
--ignore-table=$base.llx_scaninvoices_filestoimport
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
--ignore-table=$base.llx_scaninvoices_settings
--ignore-table=$base.llx_scaninvoices_settings_extrafields
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
--ignore-table=$base.llx_sellyoursaas_blacklistdir
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
--ignore-table=$base.llx_sellyoursaas_blacklistip
--ignore-table=$base.llx_sellyoursaas_blacklistmail
--ignore-table=$base.llx_sellyoursaas_blacklistto
--ignore-table=$base.llx_sellyoursaas_deploymentserver
--ignore-table=$base.llx_sellyoursaas_stats
--ignore-table=$base.llx_sellyoursaas_whitelistip
--ignore-table=$base.llx_societe_rib2
--ignore-table=$base.llx_sellyoursaas_cancellation
--ignore-table=$base.llx_ticketsup
--ignore-table=$base.llx_ultimatepdf
--ignore-table=$base.llx_update_modules
--ignore-table=$base.llx_ventilation_achat
--ignore-table=$base.tmp_llx_accouting_account
--ignore-table=$base.tmp_llx_product_batch
--ignore-table=$base.tmp_llx_product_batch2
--ignore-table=$base.tmp_tmp
--ignore-table=$base.tmp_user
"
echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile"
mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile
export res=$?

View File

@ -1,7 +1,7 @@
#!/bin/sh
# To install this precommit file: put this file in your local repo in .git/hooks directory and make it executable.
# You may need to set th DIRPHPCS to the path to your phpcs install.
# If phpcs check fail and AUTOFIX is set to 1, then it run phpcbf to fix automaticaly the syntax, and git commit is canceled.
# If phpcs checks fail and AUTOFIX is set to 1, then it run phpcbf to fix automatically the syntax, and git commit is canceled.
# If you have a multiprocessor computer, you can add to the option --parallel=xx
# When running git commit, it first execute this file checking only modified files, so it is faster than running on all files
# To run the fix manually: cd ~/git/dolibarr; phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true "fileordir"
@ -16,9 +16,9 @@ echo "Running precommit hook in .git/hooks/pre-commit" 1>&2;
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
'
oIFS=$IFS
IFS='
'
SFILES="$1"
IFS=$oIFS
fi
@ -47,11 +47,11 @@ then
# Check Dolibarr standard
${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
# Check a common standard
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=PSR2 --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
result2=$?
result2=$?
if [ "x$result2" != "x0" ]
then
@ -59,12 +59,12 @@ then
if [ "x$AUTOFIX" != "x0" ]
then
${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
#${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
echo "Found some errors in syntax rules. An automatic fix has been applied. Check it before commit." 1>&2;
exit 1
else
else
echo "Found some errors in syntax rules. Fix the error(s) before commit." 1>&2;
exit 1
fi

View File

@ -29,61 +29,61 @@ fi
# To fix
if [ "x$1" = "xfix" ]
then
for dir in `find htdocs/langs/$3* -type d`
do
dirshort=`basename $dir`
#echo $dirshort
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
if [ $aaupper = "EN" ]
then
aaupper="US"
fi
if [ $aaupper = "EL" ]
then
aaupper="GR"
fi
if [ $bb = "EG" ]
then
aaupper="SA"
fi
if [ $bb = "IQ" ]
then
aaupper="SA"
fi
for dir in `find htdocs/langs/$3* -type d`
do
dirshort=`basename $dir`
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
#echo $dirshort
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
if [ $aaupper = "EN" ]
then
aaupper="US"
fi
if [ $aaupper = "EL" ]
then
aaupper="GR"
fi
if [ $bb = "EG" ]
then
aaupper="SA"
fi
if [ $bb = "IQ" ]
then
aaupper="SA"
fi
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
echo "***** Process language "$aa"_"$bb
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
then
reflang="htdocs/langs/"$aa"_"$aaupper
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
# If $reflang is a main language to use to sanitize the alternative file
if [ -d $reflang ]
then
if [ $aa"_"$bb != $aa"_"$aaupper ]
then
echo "***** Search original into "$reflang
echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo Only one line remainging into file $fic, we delete it;
rm $fic
fi;
done
fi
fi
fi
done;
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
then
reflang="htdocs/langs/"$aa"_"$aaupper
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
# If $reflang is a main language to use to sanitize the alternative file
if [ -d $reflang ]
then
if [ $aa"_"$bb != $aa"_"$aaupper ]
then
echo "***** Search original into "$reflang
echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo "Only one line remaining into file '$fic', we delete it";
rm $fic
fi;
done
fi
fi
fi
done;
fi

View File

@ -18,7 +18,7 @@ fi
if [ "x$1" = "xlist" ]
then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert

View File

@ -7,7 +7,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
echo "Usage: detectduplicatelangkey.sh (list|fix)"
fi
@ -17,19 +17,19 @@ then
echo "Search duplicate keys into en_US lang files (there is no cross file check)"
for file in `find htdocs/langs/en_US -name *.lang -type f`
do
dupes=$(
sed "s/^\s*//" "$file" | # Remove any leading whitespace
sed "s/\s*\=/=/" | # Remove any whitespace before =
grep -Po "(^.*?)=" | # Non greedeely match everything before =
sed "s/\=//" | # Remove trailing = so we get the key
sort | uniq -d # Find duplicates
)
if [ -n "$dupes" ]
then
echo "Duplicates found in $file"
echo "$dupes"
fi
dupes=$(
sed "s/^\s*//" "$file" | # Remove any leading whitespace
sed "s/\s*\=/=/" | # Remove any whitespace before =
grep -Po "(^.*?)=" | # Non greedeely match everything before =
sed "s/\=//" | # Remove trailing = so we get the key
sort | uniq -d # Find duplicates
)
if [ -n "$dupes" ]
then
echo "Duplicates found in $file"
echo "$dupes"
fi
done
fi

View File

@ -17,22 +17,22 @@ fi
if [ "x$1" = "xlist" ]
then
echo "Search duplicate line for lang en_US"
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
then
echo "***** $file"
sort "$file" | grep -v '^$' | uniq -d
fi
done
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
then
echo "***** $file"
sort "$file" | grep -v '^$' | uniq -d
fi
done
fi
# To fix
if [ "x$1" = "xfix" ]
then
echo "Fix duplicate line for lang en_US"
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
awk -i inplace ' !x[$0]++' "$file"
done;
for file in `find htdocs/langs/en_US -type f -name *.lang`
do
awk -i inplace ' !x[$0]++' "$file"
done;
fi

View File

@ -4,17 +4,17 @@
#
for f in $(grep -l -e 'user->rights' -R); do
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *\$user->rights->\1->\2->\3 *: *0;/$user->hasRight("\1", "\2", "\3");/' $f
sed -i -r 's/ empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *0 *: *\$user->rights->\1->\2->\3;/ !$user->hasRight("\1", "\2", "\3");/' $f
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3", "\4")/g' $f
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3")/g' $f
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3", "\4")/g' $f
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3")/g' $f
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2")/g' $f
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2")/g' $f
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2")/g' $f
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *\$user->rights->\1->\2->\3 *: *0;/$user->hasRight("\1", "\2", "\3");/' $f
sed -i -r 's/ empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *0 *: *\$user->rights->\1->\2->\3;/ !$user->hasRight("\1", "\2", "\3");/' $f
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3", "\4")/g' $f
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3")/g' $f
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3", "\4")/g' $f
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3")/g' $f
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2")/g' $f
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2")/g' $f
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2", "\3")/g' $f
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2")/g' $f
done

View File

@ -17,14 +17,14 @@ fi
# To detect
if [ "x$1" = "xlist" ]
then
echo Feature not yet available
echo Feature not yet available
fi
# To convert
if [ "x$1" = "xfix" ]
then
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
find ./htdocs/install/ -type d -exec chmod ug+rw {} \;
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
find ./htdocs/install/ -type d -exec chmod ug+rw {} \;
chmod a+x ./scripts/*/*.php
chmod a+x ./scripts/*/*.sh
chmod g-w ./scripts/*/*.php

View File

@ -3,28 +3,28 @@
## Need "rpl" package
RPL_INSTALLED=$(dpkg -s rpl)
if [[ -z ${RPL_INSTALLED} ]]; then
echo "This bash need rpl command, you can install it with: sudo apt install rpl"
echo "This bash need rpl command, you can install it with: sudo apt install rpl"
fi
DIR_HTDOCS=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../htdocs" >/dev/null && pwd )
PATTERN=""
if [[ -f $1 ]]; then
TFile=("$1") # specific file
TFile=("$1") # specific file
elif [[ -n $1 ]]; then
PATTERN=$1 # name of a particular file or pattern (ex: societe.class.php)
PATTERN=$1 # name of a particular file or pattern (ex: societe.class.php)
else
PATTERN="*.class.php" # *.lib.php
PATTERN="*.class.php" # *.lib.php
fi
if [[ -n ${PATTERN} ]]; then
TCLASSFILE=$(find "${DIR_HTDOCS}" -name "${PATTERN}" | grep -v "/custom/" | grep -v "/includes/" | grep -v -F -f "${DIR_HTDOCS}/../.gitignore")
TFile=()
I=0
for f in ${TCLASSFILE}; do
TFile[${I}]="${f}"
((I++))
done
TCLASSFILE=$(find "${DIR_HTDOCS}" -name "${PATTERN}" | grep -v "/custom/" | grep -v "/includes/" | grep -v -F -f "${DIR_HTDOCS}/../.gitignore")
TFile=()
I=0
for f in ${TCLASSFILE}; do
TFile[${I}]="${f}"
((I++))
done
fi
@ -32,99 +32,99 @@ REGEX_FNC_W='^([[:blank:]]*)(public|private|protected)?[ \t]*(static)?[ \t]*[^\$
INDENT=" "
for f in ${TFile[@]}; do
# echo ${f}
# echo ${f}
IFS=$'\n'
TLine=($(cat "${f}" | grep -E "${REGEX_FNC_W}"))
IFS=$'\n'
TLine=($(cat "${f}" | grep -E "${REGEX_FNC_W}"))
for LINE in ${TLine[@]}; do
for LINE in ${TLine[@]}; do
if [[ ${LINE} =~ ^${REGEX_FNC_W}$ ]]; then
FIRST_INDENT=${BASH_REMATCH[1]} # seem not work
FNC_TYPE=${BASH_REMATCH[2]}
STATIC=${BASH_REMATCH[3]}
FNC_NAME=${BASH_REMATCH[4]}
PARAMETERS_ORIGIN=${BASH_REMATCH[5]}
BRACKET_END=${BASH_REMATCH[6]}
if [[ ${LINE} =~ ^${REGEX_FNC_W}$ ]]; then
FIRST_INDENT=${BASH_REMATCH[1]} # seem not work
FNC_TYPE=${BASH_REMATCH[2]}
STATIC=${BASH_REMATCH[3]}
FNC_NAME=${BASH_REMATCH[4]}
PARAMETERS_ORIGIN=${BASH_REMATCH[5]}
BRACKET_END=${BASH_REMATCH[6]}
if [[ ${LINE} =~ ^([[:blank:]]*) ]]; then # but this seems work to get indentation
FIRST_INDENT=${BASH_REMATCH[1]}
fi
if [[ ${LINE} =~ ^([[:blank:]]*) ]]; then # but this seems work to get indentation
FIRST_INDENT=${BASH_REMATCH[1]}
fi
[[ ${FNC_NAME} =~ ^__ ]] && continue # skip magic function
[[ ${FNC_NAME} =~ ^__ ]] && continue # skip magic function
CAMEL_CASE=$(echo "${FNC_NAME}" | sed -r 's/(_)([a-zA-Z0-9])/\U\2/g')
[[ ${CAMEL_CASE} = ${FNC_NAME} ]] && continue # skip if no difference
CAMEL_CASE=$(echo "${FNC_NAME}" | sed -r 's/(_)([a-zA-Z0-9])/\U\2/g')
[[ ${CAMEL_CASE} = ${FNC_NAME} ]] && continue # skip if no difference
#echo A: ${#FIRST_INDENT}
#printf "${FIRST_INDENT}TEST INDENT\n"
#echo B: ${FNC_TYPE}
#echo C: ${STATIC}
#echo D: ${FNC_NAME}
#echo D: ${CAMEL_CASE}
#echo E: ${PARAMETERS_ORIGIN}
#echo F: ${BRACKET_END}
#exit
#echo A: ${#FIRST_INDENT}
#printf "${FIRST_INDENT}TEST INDENT\n"
#echo B: ${FNC_TYPE}
#echo C: ${STATIC}
#echo D: ${FNC_NAME}
#echo D: ${CAMEL_CASE}
#echo E: ${PARAMETERS_ORIGIN}
#echo F: ${BRACKET_END}
#exit
[[ -n $(cat "${f}" | grep -i "function[[:blank:]]*${CAMEL_CASE}") ]] && continue # skip if already exists
[[ -n $(cat "${f}" | grep -i "function[[:blank:]]*${CAMEL_CASE}") ]] && continue # skip if already exists
TCommentLine=()
J=1
while :; do
COMMENT=$(cat ${f} | grep -B ${J} ${LINE/\$/\\$} | head -n1 | grep -P '^[\t\ ]*(/\*\*|\*[^/]?|\*/)')
if [[ -n ${COMMENT} ]]; then
TCommentLine[${J}]="${COMMENT}"
((J++))
else
break
fi
done
TCommentLine=()
J=1
while :; do
COMMENT=$(cat ${f} | grep -B ${J} ${LINE/\$/\\$} | head -n1 | grep -P '^[\t\ ]*(/\*\*|\*[^/]?|\*/)')
if [[ -n ${COMMENT} ]]; then
TCommentLine[${J}]="${COMMENT}"
((J++))
else
break
fi
done
COMMENT_ORIGIN=""
COMMENT_ORIGIN_WITH_DEPRECATED=""
COMMENT_DUPLICATE=""
if [[ ${#TCommentLine[@]} -gt 0 ]]; then
for (( idx=${#TCommentLine[@]} ; idx>0 ; idx-- )) ; do
COMMENT_ORIGIN="${COMMENT_ORIGIN}\n${TCommentLine[idx]}"
done
COMMENT_ORIGIN=""
COMMENT_ORIGIN_WITH_DEPRECATED=""
COMMENT_DUPLICATE=""
if [[ ${#TCommentLine[@]} -gt 0 ]]; then
for (( idx=${#TCommentLine[@]} ; idx>0 ; idx-- )) ; do
COMMENT_ORIGIN="${COMMENT_ORIGIN}\n${TCommentLine[idx]}"
done
COMMENT_DUPLICATE=${COMMENT_ORIGIN}
COMMENT_DUPLICATE=${COMMENT_ORIGIN}
COMMENT_ORIGIN_WITH_DEPRECATED=$(echo "${COMMENT_ORIGIN%?} @deprecated\n${FIRST_INDENT} * @see ${CAMEL_CASE}\n${FIRST_INDENT} */")
fi
COMMENT_ORIGIN_WITH_DEPRECATED=$(echo "${COMMENT_ORIGIN%?} @deprecated\n${FIRST_INDENT} * @see ${CAMEL_CASE}\n${FIRST_INDENT} */")
fi
PARAMETERS=${PARAMETERS_ORIGIN}
TParam=()
I=0
while [[ ${PARAMETERS} =~ (\$[a-zA-Z0-9\_\-]+) ]]; do
TParam[${I}]=${BASH_REMATCH[1]}
PARAMETERS=${PARAMETERS#*"${BASH_REMATCH[1]}"}
((I++))
done
PARAMETERS=${PARAMETERS_ORIGIN}
TParam=()
I=0
while [[ ${PARAMETERS} =~ (\$[a-zA-Z0-9\_\-]+) ]]; do
TParam[${I}]=${BASH_REMATCH[1]}
PARAMETERS=${PARAMETERS#*"${BASH_REMATCH[1]}"}
((I++))
done
PARAMS_STR=$(printf ", %s" "${TParam[@]}")
PARAMS_STR=${PARAMS_STR:2}
PARAMS_STR=$(printf ", %s" "${TParam[@]}")
PARAMS_STR=${PARAMS_STR:2}
REPLACE=${LINE}
[[ -z ${BRACKET_END} ]] && REPLACE="${LINE}\n${FIRST_INDENT}{\n${FIRST_INDENT}${INDENT}" || REPLACE="${LINE}\n${FIRST_INDENT}${INDENT}"
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}return self::" || REPLACE="${REPLACE}return \$this->"
REPLACE="${REPLACE}${CAMEL_CASE}(${PARAMS_STR});\n${FIRST_INDENT}}\n\n"
REPLACE="${REPLACE}${FIRST_INDENT}${COMMENT_ORIGIN}\n${FIRST_INDENT}"
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}${STATIC} "
[[ -n ${FNC_TYPE} ]] && REPLACE="${REPLACE}${FNC_TYPE} "
REPLACE="${REPLACE}function ${CAMEL_CASE}(${PARAMETERS_ORIGIN})"
[[ -n ${BRACKET_END} ]] && REPLACE="${REPLACE}\n${FIRST_INDENT}{"
REPLACE=${LINE}
[[ -z ${BRACKET_END} ]] && REPLACE="${LINE}\n${FIRST_INDENT}{\n${FIRST_INDENT}${INDENT}" || REPLACE="${LINE}\n${FIRST_INDENT}${INDENT}"
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}return self::" || REPLACE="${REPLACE}return \$this->"
REPLACE="${REPLACE}${CAMEL_CASE}(${PARAMS_STR});\n${FIRST_INDENT}}\n\n"
REPLACE="${REPLACE}${FIRST_INDENT}${COMMENT_ORIGIN}\n${FIRST_INDENT}"
[[ -n ${STATIC} ]] && REPLACE="${REPLACE}${STATIC} "
[[ -n ${FNC_TYPE} ]] && REPLACE="${REPLACE}${FNC_TYPE} "
REPLACE="${REPLACE}function ${CAMEL_CASE}(${PARAMETERS_ORIGIN})"
[[ -n ${BRACKET_END} ]] && REPLACE="${REPLACE}\n${FIRST_INDENT}{"
echo " ${FNC_NAME} -> ${CAMEL_CASE}"
echo " ${FNC_NAME} -> ${CAMEL_CASE}"
if [[ -n ${COMMENT_ORIGIN_WITH_DEPRECATED} ]]; then
rpl -e --quiet "${COMMENT_ORIGIN}" ${COMMENT_ORIGIN_WITH_DEPRECATED} "${f}"
fi
rpl -e --quiet "${LINE}" ${REPLACE} "${f}"
if [[ -n ${COMMENT_ORIGIN_WITH_DEPRECATED} ]]; then
rpl -e --quiet "${COMMENT_ORIGIN}" ${COMMENT_ORIGIN_WITH_DEPRECATED} "${f}"
fi
rpl -e --quiet "${LINE}" ${REPLACE} "${f}"
fi
fi
done
done
done

View File

@ -12,7 +12,7 @@
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]"
fi

View File

@ -3,7 +3,7 @@
# Count number of different contributors and number of commits for a given year.
# Can be used for statistics (for example to generate the inforgraphy of the year)
#
if [ "x$1" = "x" ]; then
echo "Usage: $0 YEARSTART [YEAREND]"
exit

View File

@ -21,31 +21,31 @@ cd /tmp/git/dolibarr
firstline=1
for i in "${Releases[@]}"
do
if [ $firstline -eq 1 ]; then
firstline=0
continue
fi
#echo "=== Version $i (counter $counter):"
echo "=== Version $i (counter $counter):"
echo "Get common commit ID between origin/${Releases[counter]} and origin/${Releases[counter+1]}"
echo "git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}"
commitidcommon=`git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}`
echo "Found commitid=$commitidcommon"
echo "Checkout into version $i"
git checkout $i
#git shortlog -s -n --after=YYYY-MM-DD --before=YYYY-MM-DD | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
git shortlog -s -n $commitidcommon.. | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
#cat /tmp/github_commits_perversion.txt
echo "Total for version $i:"
echo -n "- Nb of commits: "
git log $commitidcommon.. --pretty=oneline | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion2.txt
cat /tmp/github_commits_perversion2.txt | wc -l
echo -n "- Nb of different authors: "
awk ' { print $2 } ' < /tmp/github_commits_perversion.txt | sort -u | wc -l
echo "======================="
echo
let "counter +=1"
if [ $firstline -eq 1 ]; then
firstline=0
continue
fi
#echo "=== Version $i (counter $counter):"
echo "=== Version $i (counter $counter):"
echo "Get common commit ID between origin/${Releases[counter]} and origin/${Releases[counter+1]}"
echo "git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}"
commitidcommon=`git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}`
echo "Found commitid=$commitidcommon"
echo "Checkout into version $i"
git checkout $i
#git shortlog -s -n --after=YYYY-MM-DD --before=YYYY-MM-DD | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
git shortlog -s -n $commitidcommon.. | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt
#cat /tmp/github_commits_perversion.txt
echo "Total for version $i:"
echo -n "- Nb of commits: "
git log $commitidcommon.. --pretty=oneline | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion2.txt
cat /tmp/github_commits_perversion2.txt | wc -l
echo -n "- Nb of different authors: "
awk ' { print $2 } ' < /tmp/github_commits_perversion.txt | sort -u | wc -l
echo "======================="
echo
let "counter +=1"
done

View File

@ -35,20 +35,20 @@ counter=0;
offset=0;
for file in $path*$ext
do
width=`identify -format "%[fx:w]" "$file"`;
height=`identify -format "%[fx:h]" "$file"`;
idname=`basename "$file" $ext`;
clean=${idname// /-}
echo -e ".$classname.$clean {" >> $css;
echo -e "\tbackground-position:0 -${offset}px;" >> $css;
echo -e "\twidth: ${width}px;" >> $css;
echo -e "\theight: ${height}px;\n}" >> $css;
width=`identify -format "%[fx:w]" "$file"`;
height=`identify -format "%[fx:h]" "$file"`;
idname=`basename "$file" $ext`;
clean=${idname// /-}
echo -e ".$classname.$clean {" >> $css;
echo -e "\tbackground-position:0 -${offset}px;" >> $css;
echo -e "\twidth: ${width}px;" >> $css;
echo -e "\theight: ${height}px;\n}" >> $css;
echo -e "<div style=\"display:inline-block;width:100px;\"><div style=\"overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap;\">$clean</div> <a href=\"#\" class=\"$classname $clean\"></a></div>\n" >> $html;
echo -e "<div style=\"display:inline-block;width:100px;\"><div style=\"overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap;\">$clean</div> <a href=\"#\" class=\"$classname $clean\"></a></div>\n" >> $html;
let offset+=$height;
let counter+=1;
echo -e "\t#$counter done";
let offset+=$height;
let counter+=1;
echo -e "\t#$counter done";
done
echo -e "<h2>Full sprite:</h2>\n<img src=\"$classname$ext\" />" >> $html;

View File

@ -13,7 +13,7 @@ max_output_size=0
usage()
{
cat <<EO
cat <<EO
Usage: $PROGNAME (list|fix) [options]
Example: optimize_images.sh (list|fix) -i dirtoscan
@ -21,7 +21,7 @@ Script to optimize JPG and PNG images in a directory.
Options:
EO
cat <<EO | column -s\& -t
cat <<EO | column -s\& -t
-h, --help & shows this help
-q, --quiet & disables output
-i, --input [dir] & specify input directory (current directory by default)
@ -74,19 +74,19 @@ main()
test=`type pngcrush >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool pngcrush not found" && exit
echo "Tool pngcrush not found" && exit
fi
test=`type optipng >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool optipng not found" && exit
echo "Tool optipng not found" && exit
fi
test=`type jpegtran >/dev/null 2>&1`
result=$?
if [ "x$result" == "x1" ]; then
echo "Tool jpegtran not found" && exit
echo "Tool jpegtran not found" && exit
fi
@ -105,7 +105,7 @@ main()
fi
echo "Mode is $INPLACE (1=Images are replaced, 0=New images are stored into $OUTPUT)"
# We create the output directory
mkdir -p $OUTPUT
@ -125,7 +125,7 @@ main()
#echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/'"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT)
#IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/')
if [ "$QUIET" == "0" ]; then
echo --- Optimizing $INPUT ---
echo
@ -169,7 +169,7 @@ main()
human_readable_filesize()
{
echo -n $1 | awk 'function human(x) {
echo -n $1 | awk 'function human(x) {
s=" b Kb Mb Gb Tb"
while (x>=1024 && length(s)>1)
{x/=1024; s=substr(s,4)}
@ -177,7 +177,7 @@ echo -n $1 | awk 'function human(x) {
xf=(s==" b ")?"%5d ":"%.2f"
return sprintf( xf"%s", x, s)
}
{gsub(/^[0-9]+/, human($1)); print}'
{gsub(/^[0-9]+/, human($1)); print}'
}
SHORTOPTS="h,i:,o:,q,s,p"

View File

@ -58,23 +58,23 @@ fi
echo Install php-cs-fixer
PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer"
if [ ! -r "${PHP_CS_FIXER}" ] ; then
[[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install
[[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update
php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
echo
[[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install
[[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update
php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
echo
fi
# With PHP 7.0, php-cs-fixer is V2 (command check not supported)
# With PHP 8.2, php-cs-fixer is V3
(
echo cd "${MYDIR}/../../.."
cd "${MYDIR}/../../.." || exit
CMD=
# If no argument, run check by default
[[ "$1" == "" ]] && CMD=check
# shellcheck disable=SC2086
echo php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
echo cd "${MYDIR}/../../.."
cd "${MYDIR}/../../.." || exit
CMD=
# If no argument, run check by default
[[ "$1" == "" ]] && CMD=check
# shellcheck disable=SC2086
echo php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
)

View File

@ -33,24 +33,24 @@ if [ "x$1" = "xall" ]
then
if [ "x$2" = "x" ]
then
echo "tx pull -a"
tx pull -a
echo "Remove some language directories (not enough translated) like ach, br_FR, en, frp, fy_NL, ..."
rm -fr htdocs/langs/ach
rm -fr htdocs/langs/br_FR
rm -fr htdocs/langs/en
rm -fr htdocs/langs/frp
rm -fr htdocs/langs/fy_NL
echo "tx pull -a"
tx pull -a
echo "Remove some language directories (not enough translated) like ach, br_FR, en, frp, fy_NL, ..."
rm -fr htdocs/langs/ach
rm -fr htdocs/langs/br_FR
rm -fr htdocs/langs/en
rm -fr htdocs/langs/frp
rm -fr htdocs/langs/fy_NL
else
for dir in `find htdocs/langs/* -type d`
do
fic=`basename $dir`
if [ $fic != "en_US" ]
then
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3
fic=`basename $dir`
if [ $fic != "en_US" ]
then
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3
fi
done
fi
@ -60,7 +60,7 @@ else
tx pull -l $1 $2 $3 $4 $5
fi
echo Think to launch also:
echo Think to launch also:
echo "> dev/tools/fixaltlanguages.sh fix all"
#echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"

View File

@ -31,10 +31,10 @@ fi
if [ "x$1" = "xsource" ]
then
echo "tx push -s $2 $3"
tx push -s $2 $3
tx push -s $2 $3
else
if [ "x$1" = "xall" ]
then
if [ "x$1" = "xall" ]
then
for dir in `find htdocs/langs/* -type d`
do
shortdir=`basename $dir`
@ -44,7 +44,7 @@ else
echo "tx push --skip -t -l $shortdir $2 $3 $4"
tx push --skip -t -l $shortdir $2 $3 $4
done
else
else
for file in `find htdocs/langs/$1/*.lang -type f`
do
echo $file

View File

@ -2,24 +2,24 @@
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
# @copyright GPL License 2017 - Laurent Destailleur - eldy@users.sourceforge.net
# @copyright GPL License 2019 - Camille Lafitte - cam.lafit@azerttyu.net
# @copyright GPL License 2019 - Camille Lafitte - cam.lafit@azerttyu.net
#
# Convert an ODT into a PDF using "native" or "jodconverter" or "pyodconverter" or "unoconv" tool.
# Dolibarr variable MAIN_ODT_AS_PDF must be defined ...
# to value "libreoffice" to call soffice native exporter feature (in such a case, this script is useless)
# to value "libreoffice" to call soffice native exporter feature (in such a case, this script is useless)
# or value "unoconv" to call unoconv CLI tool after ODT generation.
# or value "pyodconverter" to call DocumentConverter.py after ODT generation.
# or value "jodconverter" to call jodconverter wrapper after ODT generation
# or value "/pathto/jodconverter-cli-file.jar" to call jodconverter java tool without wrapper after ODT generation.
# Dolibarr variable MAIN_DOL_SCRIPTS_ROOT must be defined to path of script directories (otherwise dolibarr will try to guess).
#
# NOTE: Using this script is depcrecated, you can now convert generated ODT to PDF on the fly by setting the value MAIN_ODT_AS_PDF
# NOTE: Using this script is deprecated, you can now convert generated ODT to PDF on the fly by setting the value MAIN_ODT_AS_PDF
# to 'libreoffice'. It requires only soffice (OpenOffice or LibreOffice) installed on server (use apt install soffice libreoffice-common libreoffice-writer).
# If you got this error: javaldx failed! Warning: failed to read path from javaldx with no return to prompt when running soffice --headless -env:UserInstallation=file:"/tmp" --convert-to pdf --outdir xxx ./yyy.odt,
# If you got this error: javaldx failed! Warning: failed to read path from javaldx with no return to prompt when running soffice --headless -env:UserInstallation=file:"/tmp" --convert-to pdf --outdir xxx ./yyy.odt,
# check that directory defined into env:UserInstallation parameters exists and is writeable.
if [ "x$1" == "x" ]
if [ "x$1" == "x" ]
then
echo "Usage: odt2pdf.sh fullfilename [native|unoconv|jodconverter|pyodconverter|pathtojodconverterjar]"
echo "Example: odt2pdf.sh myfile unoconv"
@ -30,10 +30,10 @@ fi
# Full patch where soffice is installed
# Full patch where soffice is installed
soffice="/usr/bin/soffice"
# Temporary directory (web user must have permission to read/write). You can set here path to your DOL_DATA_ROOT/admin/temp directory for example.
# Temporary directory (web user must have permission to read/write). You can set here path to your DOL_DATA_ROOT/admin/temp directory for example.
home_java="/tmp"
@ -41,60 +41,60 @@ home_java="/tmp"
if [ -f "$1.odt" ]
then
if [ "x$2" == "xnative" ]
then
$soffice --headless -env:UserInstallation=file:///$home_java/ --convert-to pdf:writer_pdf_Export --outdir $(dirname $1) "$1.odt"
exit 0
fi
if [ "x$2" == "xnative" ]
then
$soffice --headless -env:UserInstallation=file:///$home_java/ --convert-to pdf:writer_pdf_Export --outdir $(dirname $1) "$1.odt"
exit 0
fi
if [ "x$2" == "xunoconv" ]
then
# See issue https://github.com/dagwieers/unoconv/issues/87
/usr/bin/unoconv -vvv "$1.odt"
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error while converting odt to pdf: $retcode"
exit 1
fi
exit 0
fi
if [ "x$2" == "xunoconv" ]
then
# See issue https://github.com/dagwieers/unoconv/issues/87
/usr/bin/unoconv -vvv "$1.odt"
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error while converting odt to pdf: $retcode"
exit 1
fi
exit 0
fi
nbprocess=$(pgrep -c soffice)
if [ $nbprocess -ne 1 ] # If there is some soffice process running
then
cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless -env:UserInstallation=file:///$home_java/"
export HOME=$home_java && cd $home_java && $cmd&
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error running soffice: $retcode"
exit 1
fi
sleep 2
fi
if [ "x$2" == "xjodconverter" ]
then
jodconverter "$1.odt" "$1.pdf"
else
if [ "x$2" == "xpyodconverter" ]
then
python DocumentConverter.py "$1.odt" "$1.pdf"
else
java -jar $2 "$1.odt" "$1.pdf"
fi
fi
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error while converting odt to pdf: $retcode"
exit 1
fi
sleep 1
nbprocess=$(pgrep -c soffice)
if [ $nbprocess -ne 1 ] # If there is some soffice process running
then
cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless -env:UserInstallation=file:///$home_java/"
export HOME=$home_java && cd $home_java && $cmd&
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error running soffice: $retcode"
exit 1
fi
sleep 2
fi
if [ "x$2" == "xjodconverter" ]
then
jodconverter "$1.odt" "$1.pdf"
else
if [ "x$2" == "xpyodconverter" ]
then
python DocumentConverter.py "$1.odt" "$1.pdf"
else
java -jar $2 "$1.odt" "$1.pdf"
fi
fi
retcode=$?
if [ $retcode -ne 0 ]
then
echo "Error while converting odt to pdf: $retcode"
exit 1
fi
sleep 1
else
echo "Error: Odt file $1.odt does not exist"
exit 1
echo "Error: Odt file $1.odt does not exist"
exit 1
fi