<commit_before>#       mkmenus-ccorp-main.sh
#       
#       Copyright 2010 ClearCorp S.A. <<EMAIL>>
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
#!/bin/bash


# Source installation variables
if [ -d /etc/openerp/5.0 ] && [ ! -d /etc/openerp/6.0 ]; then
	branch="5"
elif [ ! -d /etc/openerp/5.0 ] && [ -d /etc/openerp/6.0 ]; then
	branch="6"
else
	branch=""
	while [[ ! $branch =~ ^[56]$ ]]; do
		read -p "You have installed versions 5 and 6, choose the version for this server (5/_6_): " branch
		if [[ $branch == "" ]]; then
			branch="6"
		fi
		echo ""
	done
fi

if [[ $branch =~ ^[5]$ ]]; then
	echo "This server will use 5.0 branch."
	branch="5.0"
else
	echo "This server will use 6.0 branch."
	branch="6.0"
fi

. /etc/openerp/$branch/install.cfg

if [[ `id -u` != `id -u $openerp_user` ]]; then
	echo "ccorp-openerp-mkmenus must be run as $openerp_user"
	exit 1
fi

if [[ ! -d $LIBBASH_CCORP_DIR ]]; then
	echo "libbash-ccorp not installed."
	exit 1
fi

if [[ ! -f /home/$openerp_user/.config/menus/applications.menu ]]; then
	cat << EOF >> /home/$openerp_user/.config/menus/applications.menu
<!DOCTYPE Menu
  PUBLIC '-//freedesktop//DTD Menu 1.0//EN'
  'http://standards.freedesktop.org/menu-spec/menu-1.0.dtd'>
<Menu>
	<Name>Applications</Name>
	<MergeFile type="parent">/etc/xdg/menus/applications.menu</MergeFile>
</Menu>
EOF
fi
#~ Delete all empty lines
sed '/^$/d' /home/$openerp_user/.config/menus/applications.menu
#~ Delete last line
sed '$d' < /home/$openerp_user/.config/menus/applications.menu > /home/$openerp_user/.config/menus/applications.menu2
mv /home/$openerp_user/.config/menus/applications.menu2 /home/$openerp_user/.config/menus/applications.menu
#~ Adds new lines
cat << EOF >> /home/$openerp_user/.config/menus/applications.menu
	<Menu>
		<Name>Development</Name>
		<Menu><commit_msg>[FIX] mkmenus-ccorp-main.sh<commit_after>#       mkmenus-ccorp-main.sh
#       
#       Copyright 2010 ClearCorp S.A. <<EMAIL>>
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
#!/bin/bash


# Source installation variables
if [ -d /etc/openerp/5.0 ] && [ ! -d /etc/openerp/6.0 ]; then
	branch="5"
elif [ ! -d /etc/openerp/5.0 ] && [ -d /etc/openerp/6.0 ]; then
	branch="6"
else
	branch=""
	while [[ ! $branch =~ ^[56]$ ]]; do
		read -p "You have installed versions 5 and 6, choose the version for this server (5/_6_): " branch
		if [[ $branch == "" ]]; then
			branch="6"
		fi
		echo ""
	done
fi

if [[ $branch =~ ^[5]$ ]]; then
	echo "This server will use 5.0 branch."
	branch="5.0"
else
	echo "This server will use 6.0 branch."
	branch="6.0"
fi

. /etc/openerp/$branch/install.cfg

if [[ `id -u` != `id -u $openerp_user` ]]; then
	echo "ccorp-openerp-mkmenus must be run as $openerp_user"
	exit 1
fi

if [[ ! -d $LIBBASH_CCORP_DIR ]]; then
	echo "libbash-ccorp not installed."
	exit 1
fi

mkdir -p /home/$openerp_user/.config/menus
mkdir -p /home/$openerp_user/.local/share/desktop-directories
mkdir -p /home/$openerp_user/.local/share/applications

if [[ ! -f /home/$openerp_user/.config/menus/applications.menu ]]; then
	cat << EOF >> /home/$openerp_user/.config/menus/applications.menu
<!DOCTYPE Menu
  PUBLIC '-//freedesktop//DTD Menu 1.0//EN'
  'http://standards.freedesktop.org/menu-spec/menu-1.0.dtd'>
<Menu>
	<Name>Applications</Name>
	<MergeFile type="parent">/etc/xdg/menus/applications.menu</MergeFile>
</Menu>
EOF
fi
#~ Delete all empty lines
sed '/^$/d' /home/$openerp_user/.config/menus/applications.menu
#~ Delete last line
sed '$d' < /home/$openerp_user/.config/menus/applications.menu > /home/$openerp_user/.config/menus/applications.menu2
mv /home/$openerp_user/.config/menus/applications.menu2 /home/$openerp_user/.config/menus/applications.menu
#~ Adds new lines
cat << EOF >> /home/$openerp_user/.config/menus/applications.menu
	<Menu>
		<Name>Development</Name>
		<Menu>
{'fraction_non_alphanumeric': 0.14006392178981011, 'fraction_numerical': 0.018800526414739612, 'mean_word_length': 3.136858475894246, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '411403', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1826, 'n_words': 543}