Commit 58b58ede authored by mlsuyt2718's avatar mlsuyt2718

add Ubuntu in distribution supported

parent 6b952b05
......@@ -3,8 +3,7 @@
# License : Creative Commons http://creativecommons.org/licenses/by-nd/4.0/deed.fr
# contact mail : <pytlin@protonmail.com>
VERSION="2019.05.02"
VERSION="2019.05.03"
set -e
#set -x
......@@ -22,8 +21,6 @@ rescolor="\033[0m"
noError="false"
# Start of script
printf "\n%b$green\n"
printf "#########################################################\n"
......@@ -45,6 +42,9 @@ then
exit 1
fi
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
......@@ -86,6 +86,8 @@ helpFunction ()
printf "\t\t 1 => mixer node without tor (default value)\n"
printf "\t\t 2 => mixer node connected to tor\n"
printf "\t\t 3 => mixer node into tor network : hidden service\n"
#printf "\t-g This parameter permits to generate randomly the public key\n"
#printf "\t-d This parameter permits to launch gmixer in daemon\n"
printf "\t-v This parameter activate verbose mode\n"
printf "\t-h This parameter print out the help\n"
exit 1 # Exit script after printing help
......@@ -116,7 +118,7 @@ getGmixerProject () {
generateConfFolder () {
noError="false"
if [ ! -d "$HOME/.gmixer" ]; then
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
$HOME/gmixer-py/python3.7 server.py -i
checkCommand
elif [ "$OS" = "CentOS Linux" ]; then
......@@ -158,7 +160,7 @@ checkCommand() {
#update system with package manager : apt for debian derivative system and yum for centos derivated system
updateSystem () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
sudo apt-get update -y && sudo apt-get upgrade -y
checkCommand
elif [ "$OS" = "CentOS Linux" ]; then
......@@ -173,7 +175,7 @@ updateSystem () {
#installation of dependancies for Python
installDepPython () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
sudo apt-get install build-essential sqlite3 bzip2 libbz2-dev zlib1g-dev openssl libgdbm-dev liblzma-dev libreadline-dev libffi-dev apt-transport-https -y
checkCommand
elif [ "$OS" = "CentOS Linux" ]; then
......@@ -187,7 +189,7 @@ installDepPython () {
installDepPythonForGMixer () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
sudo apt-get install python3-pip python3 python-dev python3-dev build-essential libffi-dev libxml2-dev libxslt1-dev zlib1g-dev -y 2> /dev/null
sudo pip3 install --upgrade pip 2> /dev/null
sudo pip3 install libnacl duniterpy silkaj py-ubjson plyvel PySocks 2> /dev/null
......@@ -206,7 +208,7 @@ installDepPythonForGMixer () {
#installation of dependancies for Gmixer
installDepGMixer () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
sudo apt-get install libsodium-dev -y
checkCommand
elif [ "$OS" = "CentOS Linux" ]; then
......@@ -221,7 +223,7 @@ installDepGMixer () {
installPython () {
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
if [ ! -d "/usr/src/Python-3.7.3" ]; then
cd /usr/src
......@@ -284,7 +286,7 @@ installPython () {
checkInstallCmake () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
vCmake=$(cmake --version)
cmakeStr="cmake version 3.14.3"
if [ -z "${vCmake##*$cmakeStr*}" ]
......@@ -321,7 +323,7 @@ checkInstallCmake () {
checkInstallPython () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
vPython=$(python3.7 -V)
pythonStr="Python"
if [ -z "${vPython##*$pythonStr*}" ]
......@@ -355,7 +357,7 @@ checkInstallPython () {
launchGMixer () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
python3.7 $HOME/gmixer-py/server.py -s -d $HOME/.gmixer
elif [ "$OS" = "CentOS Linux" ]; then
python3.6 $HOME/gmixer-py/server.py -s -d $HOME/.gmixer
......@@ -368,7 +370,7 @@ launchGMixer () {
installOrBuildCmake () {
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
if [ ! -d "/usr/src/cmake-3.14.3" ]; then
cd /usr/src
......@@ -419,7 +421,7 @@ checkBuildLevelDB () {
buildLevelDB () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
cd /usr/src
sudo rm -rf /usr/src/1.21.tar.gz
#for plylevel install leveldb >=1.21 (build it by hand on debian stretch, CMake 3.9 or higher is required)
......@@ -471,7 +473,7 @@ checkTorInstallation () {
openPortGMixer () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
sudo iptables -A INPUT -p tcp -m tcp --dport 10951 -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m tcp --dport 10951 -j ACCEPT
......@@ -494,7 +496,7 @@ openPortGMixer () {
modifiyConfigurationFile () {
noError="false"
if [ "$OS" = "Debian GNU/Linux" ]; then
if [ "$OS" = "Debian GNU/Linux" ] || [ "$OS" = "Ubuntu" ]; then
printf "%bretrieve public ip...%b" "${yellow}" "${rescolor}"
ip=$( getPublicIp )
sed -i "s/127.0.1.1/`echo $ip`/g" $HOME/.gmixer/config.json
......@@ -551,6 +553,22 @@ configurationTor () {
fi
}
generateRandomSalt () {
salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-44} | head -n 1)
pass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-44} | head -n 1)
echo $salt
echo $pass
}
generateRandomPass () {
salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-44} | head -n 1)
echo $salt
}
generateRandomKey () {
}
main () {
printf "\n%bUpdate system...%b" "${yellow}" "${rescolor}"
......@@ -709,6 +727,20 @@ mainVerbose () {
fi
fi
fi
if [ "$parameterG" = "true" ]
then
printf "%bGenerate Random Key...%b" "${yellow}" "${rescolor}"
generateRandomSalt
generateRandomPass
checkCommand
printOkKo
else
printf "%bEnter Salt and Password...%b" "${yellow}" "${rescolor}"
fi
printf "%bLaunch GMixer : %b\n" "${yellow}" "${rescolor}"
launchGMixer
......@@ -723,13 +755,17 @@ mainVerbose () {
parameterV="false"
parameterH="false"
parameterG="false"
parameterD="false"
while getopts "t:vh" opt
while getopts "t:vhgd" opt
do
case "$opt" in
t ) parameterT="$OPTARG" ;;
v ) parameterV="true" ;;
h ) parameterH="true" ;;
g ) parameterG="true" ;;
d ) parameterD="true" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
......@@ -753,6 +789,7 @@ else
fi
#---------------------------end of programm-----------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment