Improve error management in install. Finish Kalkun install OK

This commit is contained in:
poka 2019-12-15 01:55:15 +00:00
parent aa9a7d2254
commit a3db607d8e
8 changed files with 410 additions and 69 deletions

View File

@ -5,70 +5,76 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
OS=$(head -n1 $MY_PATH/.OS)
isARM=$(cat $MY_PATH/.OS | grep YES)
unset err
# Basics
sudo apt update
echo -e "${c_yellow}Mise à jours des prérequis...$c_"
sudo apt install curl jq zip unzip htop tree ntpdate gnupg ssmtp mpack imagemagick qrencode bc -y
# Silkaj + Duniterpy
silkaj() {
echo -e "${c_yellow}Installation de Silkaj...$c_"
libsodium=$(sudo apt search libsodium 2>/dev/null | grep -v -E "header|debug symbols" | grep "Network communication" -B1 | head -n1 | awk -F '/' '{ print $1 }')
[[ $libsodium =~ " " ]] && libsodium=$(echo $libsodium | awk '{ print $2 }')
sudo apt install python3-pip $libsodium -y || err=1
pip3 install duniterpy || err=1
pip3 install silkaj --user || err=1
sudo apt install python3-pip $libsodium -y || err+="Install python3 and $libsodium"
pip3 install duniterpy || err+="Install duniterpy"
pip3 install silkaj --user || err+="Install Silkaj"
}
# Install IPFS
ipfs() {
echo -e "${c_yellow}Installation d'IPFS...$c_"
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
if [[ $isARM ]]; then
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err=1
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
else
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err=1
wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
fi
echo "INSTALL ipfs-update"
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err=1
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update"
rm $MY_PATH/ipfs-update.tar.gz
cd /usr/src/ipfs-update/
sudo ./install.sh || err=1
sudo ./install.sh || err+="Install ipfs-update"
cd $MY_PATH
echo "INSTALL latest ipfs"
sudo ipfs-update install latest || err=1
sudo ipfs-update install latest || err+="Install IPFS"
echo "CREATE SYSTEMD ipfs SERVICE"
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
sudo cp -f $MY_PATH/templates/1/ipfs.service /etc/systemd/system/
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
sudo systemctl daemon-reload || err=1
sudo systemctl enable ipfs || err=1
sudo systemctl daemon-reload || err+="Restart IPFS"
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
}
# Install gammu
gammu() {
sudo apt install ppp screen git minicom gammu -y || err=1
echo -e "${c_yellow}Installation de gammu...$c_"
sudo apt install ppp screen git minicom gammu -y || err+="Install gammu requirements"
sleep 1
sudo apt install gammu-smsd -y || sudo apt install -f || err=1
sudo apt install gammu-smsd -y || sudo apt install -f || err+="Install gammu"
sudo usermod -aG gammu $USER
}
# Install PHP + MySQL
php() {
echo -e "${c_yellow}Installation de PHP et MySQL$c_"
if [[ $OS == "buster" ]]; then
sudo apt -y install software-properties-common nginx php php-common php-fpm php-gettext php-gd php-mysql php-curl php-imap php-mbstring php-xml php-cli mariadb-server || err=1
sudo apt -y install software-properties-common nginx php php-common php-fpm php-gettext php-gd php-mysql php-curl php-imap php-mbstring php-xml php-cli mariadb-server || err+="Install PHP and MySQL"
elif [[ $OS == "stretch" ]]; then
sudo apt -y install lsb-release apt-transport-https ca-certificates || err=1
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg || err=1
sudo apt -y install lsb-release apt-transport-https ca-certificates || err+="Install apt-transport-https"
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg || err+="Download PHP key"
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 || err=1
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 || err+="Download PHP key"
sudo apt update
sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-gettext php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server || err=1
sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-gettext php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server || err+="Install PHP and MySQL"
else
echo "${c_red}Votre système n'est pas pris en charge par ce script d'installation.$c_"
exit 1
@ -88,7 +94,7 @@ for i in $@; do
done
if [[ $err ]]; then
echo -e "${c_red}Installation des prérequis incomplète$c_"
echo -e "${c_red}Installation des prérequis incomplète: $err$c_"
exit 1
else
echo -e "${c_green}Les prérequis ont été correctement installés$c_"

View File

@ -2,7 +2,7 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
templates="$MY_PATH/templates"
templates="$MY_PATH/templates/3"
isARM=$(cat $MY_PATH/.OS | grep YES)

View File

@ -19,7 +19,6 @@ DOMAIN=$KSMS_DOMAIN
$MY_PATH/1-install_requirements.sh php
## Create database
if [[ $(sudo mysql -e "select * from mysql.user;" | grep gammu) ]]; then
pwdDB=$(cat /etc/gammu-smsdrc | grep "password" | grep -v "# " | awk '{ print $3 }')
else
@ -28,28 +27,37 @@ else
fi
if [[ ! $(sudo mysql -e "show databases;" | grep gammu) ]]; then
echo -e "${c_yellow}Création de la base de donnée...$c_"
sudo mysql -e "CREATE DATABASE gammu"
sudo mysql -e "GRANT ALL PRIVILEGES ON gammu.* TO 'gammu'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
fi
[[ ! $(sudo mysql gammu -e "SHOW TABLES LIKE 'outbox';") ]] && sudo mysql gammu < $MY_PATH/templates/4a/mysql.sql || err=1
if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'outbox';") ]]; then
echo -e "${c_yellow}Importation du dump gammu...$c_"
sudo mysql gammu < $MY_PATH/templates/4a/mysql.sql || err+="Import dump MySQL"
fi
if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'kalkun';") ]]; then
echo -e "${c_yellow}Importation du dump kalkun...$c_"
sudo mysql gammu < $MY_PATH/templates/4a/kalkun.sql || err+="Import dump Kalkun"
fi
## Clone repo KALKUN
[[ -d $MY_PATH/kalkun ]] && sudo rm -rf $MY_PATH/kalkun
echo -e "${c_yellow}Clonage du dépot de Kalkun...$c_"
git clone https://github.com/back2arie/Kalkun.git $MY_PATH/kalkun
cp $MY_PATH/templates/4a/database.php $MY_PATH/kalkun/application/config/
cp $MY_PATH/templates/4a/daemon.sh $MY_PATH/templates/4a/daemon.php $MY_PATH/kalkun/scripts
sed -i "s/_PWD/$pwdDB/g" $MY_PATH/kalkun/application/config/database.php || err=1
echo "debug 1"
sed -i "s/_DOMAIN/$DOMAIN/g" $MY_PATH/templates/4a/daemon.php || err=1
sed -i "s/_PWD/$pwdDB/g" $MY_PATH/kalkun/application/config/database.php || err+="Sed database password"
sed -i "s/_DOMAIN/$DOMAIN/g" $MY_PATH/templates/4a/daemon.php || err+="Sed domaine to daemon.php"
# touch $MY_PATH/kalkun/install
## Place le dossier kalkun dans /var/www/
[[ -d /var/www/kalkun ]] && sudo rm -rf /var/www/kalkun
sudo mv $MY_PATH/kalkun /var/www/ || err=1
sudo chown -R www-data:www-data /var/www/kalkun || err=1
sudo mv $MY_PATH/kalkun /var/www/ || err+="Move kalkun to /var/www"
sudo chown -R www-data:www-data /var/www/kalkun || err+="Chown www-data to kalkun"
sudo chmod u+x /var/www/kalkun/scripts/*
## Add daemon launcher in sms_received.sh
@ -57,40 +65,47 @@ sudo chmod u+x /var/www/kalkun/scripts/*
## Active gammu in MySQL mode
if [[ $(grep "service = files" /etc/gammu-smsdrc) ]]; then
sudo sed -i "/^service = files/a service = sql\ndriver = native_mysql\nhost = localhost\nuser = gammu\npassword = $pwdDB\ndatabase = gammu" /etc/gammu-smsdrc || err=1
sudo sed -i "/service = files/d" /etc/gammu-smsdrc || err=1
$MY_PATH/../debug/gammu-restart.sh || err=1
echo -e "${c_yellow}Activation de gammu-smsd en mode MySQL...$c_"
sudo sed -i "/^service = files/a service = sql\ndriver = native_mysql\nhost = localhost\nuser = gammu\npassword = $pwdDB\ndatabase = gammu" /etc/gammu-smsdrc || err+="Sed gammu-smsd"
sudo sed -i "/service = files/d" /etc/gammu-smsdrc || err+="Sed delete in gammu-smsd"
$MY_PATH/../debug/gammu-restart.sh || err+="Restart gammu"
fi
## Config NGINX
echo -e "${c_yellow}Configuration de Nginx...$c_"
[[ ! -d /etc/nginx/def_conf ]] && sudo mkdir /etc/nginx/def_conf/
sudo cp $MY_PATH/templates/rproxy/proxypass.conf /etc/nginx/def_conf/ || err=1
sudo cp $MY_PATH/templates/4a/kalkun.conf /etc/nginx/conf.d/ || err=1
sudo sed -i "s/_DOMAIN/$DOMAIN/g" /etc/nginx/conf.d/kalkun.conf || err=1
sudo cp $MY_PATH/templates/rproxy/proxypass.conf /etc/nginx/def_conf/ || err+="Copy proxypass.conf"
sudo cp $MY_PATH/templates/4a/kalkun.conf /etc/nginx/conf.d/ || err+="Copy kalkun.conf"
sudo sed -i "s/_DOMAIN/$DOMAIN/g" /etc/nginx/conf.d/kalkun.conf || err+="Sed domain in kalkun.conf"
## Active SSL
[[ ! $noask ]] && printf "${c_yellow}Voulez-vous installer et activer un certificat SSL maintenant pour $DOMAIN ? (o/n) $c_" && read askSSL
if [[ $askSSL =~ ^(o|y|yes|oui|Y|O|YES)$ ]]; then
$MY_PATH/ssl.sh certif APP=kalkun DOMAIN=$DOMAIN || err=1
if sudo test ! -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then
$MY_PATH/ssl.sh certif APP=kalkun DOMAIN=$DOMAIN || err+="Create SSL certification"
fi
if sudo test -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then
$MY_PATH/ssl.sh on APP=kalkun DOMAIN=$DOMAIN || err=1
$MY_PATH/ssl.sh on APP=kalkun DOMAIN=$DOMAIN || err+="Enable SSL certification"
else
echo -e "${c_red}Une erreur s'est produite, basculement vers le mode non SSL$c_"
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err=1
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err+="Disable SSL certification"
fi
http=https
sudo sed -i "s/http/https/g" /var/www/kalkun/scripts/daemon.php || err=1
sudo sed -i "s/http/https/g" /var/www/kalkun/scripts/daemon.php || err+="Sed http to https in daemon.php"
else
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err=1
$MY_PATH/ssl.sh off APP=kalkun DOMAIN=$DOMAIN || err+="Disable SSL certification"
http=http
fi
sudo service nginx restart || err=1
echo -e "${c_yellow}Redémarrage de Nginx...$c_"
sudo service nginx restart || err+="Restart Nginx"
echo -e "${c_yellow}Redémarrage de gammu-smsd...$c_"
$MY_PATH/../debug/gammu-restart.sh || err+="Restart gammu"
if [[ $err ]]; then
echo -e "${c_red}Installation incomplète$c_"
echo -e "${c_red}Installation incomplète: $err$c_"
exit 1
else
echo -e "${c_green}Kalkun est accessible via l'URL $http://$DOMAIN$c_"

View File

@ -4,8 +4,8 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
### Vars
#DOMAIN=g1sms-blois-2.p2p.legal
args=$@
args=$(echo $@ | tr " " "\n")
if [[ "$args" =~ "DOMAIN=" ]]; then
DOMAIN=$(echo "$args" | grep "\<DOMAIN=" | awk -F '=' '{ print $2 }')
else
@ -19,7 +19,7 @@ else
exit 1
fi
action=$(echo "$args" | tr " " "\n" | grep -v "=")
action=$(echo "$args" | grep -v "=")
[[ ! $action =~ ^(on|off|certif)$ ]] && echo "Veuillez choisir on, off ou certif pour créer un certificat ssl" && exit 1
###
@ -50,7 +50,7 @@ create_certificate() {
case $action in
on)
sudo sed -i 's/ #if/ if/g' /etc/nginx/conf.d/$DOMAIN.conf
sudo sed -i 's/ #if/ if/g' /etc/nginx/conf.d/$APP.conf
sudo sed -i "s/listen 443;/listen 443 ssl;/g" /etc/nginx/conf.d/$APP.conf
[[ ! -d /etc/nginx/includes ]] && sudo mkdir /etc/nginx/includes
@ -59,13 +59,13 @@ on)
;;
off)
sudo sed -i 's/ if/ #if/g' /etc/nginx/conf.d/$APP.conf
sudo sed -i '/ssl.conf;/d' /etc/nginx/conf.d/$APP.conf
sudo sed -i '/ssl_certificate/d' /etc/nginx/conf.d/$APP.conf
sudo sed -i "s/ if/ #if/g" /etc/nginx/conf.d/$APP.conf
sudo sed -i "/ssl.conf;/d" /etc/nginx/conf.d/$APP.conf
sudo sed -i "/ssl_certificate/d" /etc/nginx/conf.d/$APP.conf
;;
certif)
[[ -z $(which certbot) ]] && install_certbot
[[ -n /etc/letsencrypt/live/$DOMAIN/fullchain.pem ]] && create_certificate
[[ ! $(which certbot) ]] && install_certbot
if sudo test ! -f /etc/letsencrypt/live/$DOMAIN/fullchain.pem; then create_certificate; fi
;;
esac

View File

@ -0,0 +1,331 @@
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 22, 2011 at 05:38 PM
-- Server version: 5.1.37
-- PHP Version: 5.3.0
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `kalkun`
--
-- --------------------------------------------------------
--
-- Table structure for table `kalkun`
--
CREATE TABLE IF NOT EXISTS `kalkun` (
`version` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `sms_used`
--
CREATE TABLE IF NOT EXISTS `sms_used` (
`id_sms_used` int(11) NOT NULL AUTO_INCREMENT,
`sms_date` date NOT NULL,
`id_user` int(11) NOT NULL,
`out_sms_count` int(11) NOT NULL DEFAULT '0',
`in_sms_count` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_sms_used`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id_user` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(12) NOT NULL,
`realname` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`phone_number` varchar(15) NOT NULL,
`level` enum('admin','user') NOT NULL DEFAULT 'user',
PRIMARY KEY (`id_user`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `phone_number` (`phone_number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`id_user`, `username`, `realname`, `password`, `phone_number`, `level`) VALUES
(1, 'kalkun', 'Kalkun SMS', 'f0af18413d1c9e0366d8d1273160f55d5efeddfe', '123456789', 'admin');
-- --------------------------------------------------------
--
-- Table structure for table `user_folders`
--
CREATE TABLE IF NOT EXISTS `user_folders` (
`id_folder` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_user` int(11) NOT NULL,
PRIMARY KEY (`id_folder`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Dumping data for table `user_folders`
--
INSERT INTO `user_folders` (`id_folder`, `name`, `id_user`) VALUES
(1, 'inbox', 0),
(2, 'outbox', 0),
(3, 'sent_items', 0),
(4, 'draft', 0),
(5, 'Trash', 0),
(6, 'Spam', 0);
-- --------------------------------------------------------
--
-- Table structure for table `user_inbox`
--
CREATE TABLE IF NOT EXISTS `user_inbox` (
`id_inbox` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`trash` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_inbox`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_outbox`
--
CREATE TABLE IF NOT EXISTS `user_outbox` (
`id_outbox` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
PRIMARY KEY (`id_outbox`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_sentitems`
--
CREATE TABLE IF NOT EXISTS `user_sentitems` (
`id_sentitems` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
`trash` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_sentitems`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_settings`
--
CREATE TABLE IF NOT EXISTS `user_settings` (
`id_user` int(11) NOT NULL,
`theme` varchar(10) NOT NULL DEFAULT 'blue',
`signature` varchar(50) NOT NULL,
`permanent_delete` enum('true','false') NOT NULL DEFAULT 'false',
`paging` int(2) NOT NULL DEFAULT '10',
`bg_image` varchar(50) NOT NULL,
`delivery_report` enum('default','yes','no') NOT NULL DEFAULT 'default',
`language` varchar(20) NOT NULL DEFAULT 'english',
`conversation_sort` enum('asc','desc') NOT NULL DEFAULT 'asc',
`country_code` varchar(2) NOT NULL DEFAULT 'US',
PRIMARY KEY (`id_user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_settings`
--
INSERT INTO `user_settings` (`id_user`, `theme`, `signature`, `permanent_delete`, `paging`, `bg_image`, `delivery_report`, `language`, `conversation_sort`) VALUES
(1, 'green', 'false;--\nPut your signature here', 'false', 20, 'true;background.jpg', 'default' , 'english', 'asc');
-- --------------------------------------------------------
--
-- Alter table structure for table `inbox`
--
ALTER TABLE `inbox` ADD `id_folder` INT( 11 ) NOT NULL DEFAULT '1',
ADD `readed` ENUM( 'false', 'true' ) NOT NULL DEFAULT 'false';
-- --------------------------------------------------------
--
-- Alter table structure for table `sentitems`
--
ALTER TABLE `sentitems` ADD `id_folder` INT( 11 ) NOT NULL DEFAULT '3';
-- --------------------------------------------------------
-- mulai versi db 16, pbk dan pbk__groups dihapus di gammu
--
-- Alter table structure for table `pbk`
--
CREATE TABLE `pbk` (
`ID` integer NOT NULL auto_increment,
`GroupID` integer NOT NULL default '-1',
`Name` text NOT NULL,
`Number` text NOT NULL,
PRIMARY KEY (`ID`)
);
--
-- Dumping data for table `pbk`
--
-- --------------------------------------------------------
--
-- Table structure for table `pbk_groups`
--
CREATE TABLE `pbk_groups` (
`Name` text NOT NULL,
`ID` integer NOT NULL auto_increment,
PRIMARY KEY `ID` (`ID`)
);
ALTER TABLE `pbk` ADD `id_user` INT( 11 ) NOT NULL;
ALTER TABLE `pbk` ADD `is_public` enum('true','false') NOT NULL DEFAULT 'false';
-- --------------------------------------------------------
--
-- Alter table structure for table `pbk_groups`
--
ALTER TABLE `pbk_groups` ADD `id_user` INT( 11 ) NOT NULL;
ALTER TABLE `pbk_groups` ADD `is_public` enum('true','false') NOT NULL DEFAULT 'false';
-- --------------------------------------------------------
--
-- Table structure for table `user_group`
--
CREATE TABLE IF NOT EXISTS `user_group` (
`id_group` int(11) NOT NULL AUTO_INCREMENT,
`id_pbk` int(11) NOT NULL,
`id_pbk_groups` int(11) NOT NULL,
`id_user` int(11) NOT NULL,
PRIMARY KEY (`id_group`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_templates`
--
CREATE TABLE IF NOT EXISTS `user_templates` (
`id_template` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(11) NOT NULL,
`Name` varchar(64) NOT NULL,
`Message` text NOT NULL,
PRIMARY KEY (`id_template`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
-- --------------------------------------------------------
--
-- Table structure for table `b8_wordlist`
--
CREATE TABLE `b8_wordlist` (
`token` varchar(255) character set utf8 collate utf8_bin NOT NULL,
`count` varchar(255) default NULL,
PRIMARY KEY (`token`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `b8_wordlist` VALUES ('bayes*dbversion', '2');
INSERT INTO `b8_wordlist` VALUES ('bayes*texts.ham', '0');
INSERT INTO `b8_wordlist` VALUES ('bayes*texts.spam', '0');
-- --------------------------------------------------------
--
-- Table structure for table `plugins`
--
CREATE TABLE IF NOT EXISTS `plugins` (
`plugin_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`plugin_system_name` varchar(255) NOT NULL,
`plugin_name` varchar(255) NOT NULL,
`plugin_uri` varchar(120) DEFAULT NULL,
`plugin_version` varchar(30) NULL,
`plugin_description` text,
`plugin_author` varchar(120) DEFAULT NULL,
`plugin_author_uri` varchar(120) DEFAULT NULL,
`plugin_data` longtext,
PRIMARY KEY (`plugin_id`),
UNIQUE KEY `plugin_index` (`plugin_system_name`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_forgot_password`
--
CREATE TABLE IF NOT EXISTS `user_forgot_password` (
`id_user` int(11) NOT NULL,
`token` varchar(255) NOT NULL,
`valid_until` datetime NOT NULL,
PRIMARY KEY (`id_user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_filters`
--
CREATE TABLE IF NOT EXISTS `user_filters` (
`id_filter` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(11) NOT NULL,
`from` varchar(15) NOT NULL,
`has_the_words` varchar(50) NOT NULL,
`id_folder` int(11) NOT NULL,
PRIMARY KEY (`id_filter`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

View File

@ -178,15 +178,3 @@ CREATE INDEX sentitems_sender ON sentitems(SenderID(250));
--
-- Dumping data for table `sentitems`
--
--
-- Table structure for `ci_sessions`
--
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);

View File

@ -8,6 +8,7 @@ MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
init_loc="$MY_PATH/shell/init.sh"
now=$(date +%Y-%m-%d)
unset err
## Récupère les données du profile
[[ -f $MY_PATH/.profile ]] && source $MY_PATH/.profile
@ -35,7 +36,7 @@ if [ "$EUID" -eq 0 ]
fi
## Update G1sms+ code
git pull || err=1
git pull || err+=1
chmod u+x $MY_PATH/.install/*.sh
@ -45,8 +46,8 @@ $MY_PATH/.install/export_colors.sh
## Vérifie si IPFS est installé
if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then
echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_"
$MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err=1
$MY_PATH/.install/2-configure_ipfs_layer.sh || err=1
$MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1
$MY_PATH/.install/2-configure_ipfs_layer.sh || err+=1
else
echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
fi
@ -70,7 +71,7 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
[[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ?$c_" && read
[[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
cp $MY_PATH/.install/templates/init.sh shell/init.sh || err=1
cp $MY_PATH/.install/templates/init.sh shell/init.sh || err+=1
sed -i s/pi/$YOU/g $init_loc
sed -i s/+33600000000/$MASTERPHONE/g $init_loc
@ -79,7 +80,7 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
sed -i s/Fred/$ADMINPSEUDO/g $init_loc
else
echo -e "${c_red}init.sh introuvable...$c_"
err=1
err+=1
exit 1
fi
@ -87,11 +88,11 @@ fi
repOld=$repOption
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer les modules complémentaires de copylaradio ? (o/n)$c_" && read repOption
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/3-install_copylaradio.sh || err=1; fi; repOption=$repOld
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/3-install_copylaradio.sh || err+=1; fi; repOption=$repOld
[[ -z $repOption ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web Kalkun ? (o/n)$c_" && read repOption
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then isKalkun=1; $MY_PATH/.install/4a-install_kalkun.sh || err=1; fi; repOption=$repOld
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then isKalkun=1; $MY_PATH/.install/4a-install_kalkun.sh || err+=1; fi; repOption=$repOld
[[ -z $repOption && -z $isKalkun ]] && echo -e "${c_yellow}Voulez-vous installer l'interface web playSMS ? (o/n)$c_" && read repOption
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/4b-install_playsms.sh || err=1; fi; repOption=$repOld
if [[ $repOption =~ ^(o|1|yes|options|a|all)$ ]]; then $MY_PATH/.install/4b-install_playsms.sh || err+=1; fi; repOption=$repOld
if [[ $err ]]; then
echo -e "---\n${c_red}L'installation générale n'est mal déroulé =($c_"