Coder Social home page Coder Social logo

kayofeld / script-installation-ordinateur-epitech Goto Github PK

View Code? Open in Web Editor NEW
57.0 7.0 22.0 43 KB

Script d'installation pour OS basés LINUX pour travailler à Epitech. CECI NE MARCHERA PAS SI VOUS N'ETES PAS INSCRITS À EPITECH

Emacs Lisp 26.93% Python 42.45% Shell 22.07% Roff 8.54%

script-installation-ordinateur-epitech's Introduction

Script d'installation de la configuration Epitech pour OS basés Debian (*buntu, Mint..), Archlinux, Fedora, Opensuse, Gentoo

Ce script a pour but de vous permettre de travailler sur vos projets EPITECH, même si vous avez choisi un autre OS que le dump du bocal.

The installation script might work on any distribution based on :

  • opensuse
  • archlinux
  • fedora
  • debian
  • gentoo

Utilisation :

Commande :

$  ./install <[email protected]>

Argument :

<[email protected]> : Votre login Epitech

Ce que le script fait :

  • mise à jour de votre système

  • installation des paquets suivant :

    • blih
    • emacs (et la configuration epitech)
    • build-essentials (libc etc. pour compilation)
    • libncurses
    • curl
    • git
    • zsh
    • oh-my-zsh
    • terminator
    • valgrind
    • ocaml
    • tree
    • filezilla
    • man google (bonus)
  • paquet en option :

    • makefile-gen
  • génère et uploade votre clé ssh sur le serveur epitech

  • change votre shell de base en zsh

  • les headers Epitech contiennent le login même si le username sur la session est différent

Auteur

  • montag_p

Contributeurs

  • lesell_b

Pour toute suggestion, n'hesitez pas à ouvrir une issue (dans github)

Ce script a été écrit par montag_p, pour toute suggestion, envoyer un mail à paul[at]montague[dot]fr

script-installation-ordinateur-epitech's People

Contributors

bew avatar extragornax avatar kayofeld avatar killmax avatar psilokos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

script-installation-ordinateur-epitech's Issues

Support for Solus

Hi,

I'm using Solus and I found this tool kinda useful so I decided to port it on Solus :)
The problem is that build-essential and libncurses5 aren't called that way in Solus' repo so I replaced them with make and g++.

Here is the code :

#! /bin/bash

# variables

## script

files="./.files"
dir_tmp="/tmp/install"

login=$1

## fake install ?

fake=0

## colors

ESC="\033["
C_RED=$ESC"0;31m"
C_YELLOW=$ESC"0;33m"
C_BWHITE=$ESC"1;37m"
C_RST=$ESC"0m"


function usage
{
	echo
	echo "Usage: $0 <[email protected]>"
	echo
	echo "<[email protected]> : Votre login Epitech"
	echo
}

function line
{
	cols=$(tput cols)
	char=$1
	color=$2

	if test "$color" != ""; then
		echo -ne $color
	fi

	for i in $(eval echo "{1..$cols}"); do
		echo -n $char
	done
	echo

	if test "$color" != ""; then
		echo -ne $C_RST
	fi
}

function script_header
{

	color=$2
	if test "$color" = ""; then
		color=$C_RED
	fi

	echo -ne $color
	line "-"
	echo "##> "$1
	line "-"
	echo -ne $C_RST
}

function handle_error
{
	result=$1
	if test $result -eq 0; then
		return
	else
		line "#" $C_RED
		line "#" $C_YELLOW
		echo -en $C_RED"[Erreur]"$C_RST" lors de l'installation, voulez-vous arreter le script ? [O/n]  "
		read stop_script
		case $stop_script in
			n|N)	return;;
			*)		exit 1;;
		esac
	fi
}

function get_os_type
{
	which zypper &> /dev/null && os="opensuse"
	which pacman &> /dev/null && os="archlinux"
	which dnf &> /dev/null && os="fedora"
	which apt-get &> /dev/null && os="debian"
	which emerge &> /dev/null && os="gentoo"
    which eopkg &> /dev/null && os="solus"
}

function script_init
{
	os="void"
	get_os_type

	if test "$os" = "void"; then
		line "#" $C_YELLOW
		script_header "VOTRE DISTRIBUTION N'EST PAS SUPPORTÉE..."
		line "#" $C_YELLOW
		exit 42
	fi

	rm -rf $dir_tmp
	mkdir $dir_tmp
}

function sys_upgrade
{
	if test $fake -eq 1; then
		echo "Upgrade system"
		return
	fi
	case "$os" in
		opensuse)
			sudo zypper update
			;;
		archlinux)
			sudo pacman -Syu
			;;
		fedora)
			sudo dnf update
			;;
        solus)
            sudo eopkg up
            ;;
		debian)
			sudo apt-get update; sudo apt-get upgrade
			;;
		gentoo)
			sudo emerge -u world
			;;
	esac
	handle_error $?
}

function sys_install
{
	package_name=$1

	function get_cmd_install
	{
		case "$os" in
			opensuse)
				echo "zypper install"
				;;
			archlinux)
				echo "pacman -S"
				;;
			fedora)
				echo "dnf install"
				;;
            solus)
                echo "eopkg it"
                ;;
			debian)
				echo "apt-get install"
				;;
			gentoo)
				echo "emerge"
				;;
		esac
	}

	if test -z "$cmd_install"; then
		cmd_install=$(get_cmd_install)
	fi

	if test $fake -eq 1; then
		echo "Installing" $package_name "(command:" $cmd_install $package_name ")"
		return
	fi

	sudo $cmd_install $package_name
	handle_error $?
}

function script_install
{
	if test $fake -eq 1; then
		echo "Installing" $1 "(script_install)"
		return
	fi
	sudo cp $files/$1 /usr/bin/$1
	handle_error $?
	sudo chmod 755 /usr/bin/$1
	handle_error $?
}

function setup_emacs
{
	if test $fake -eq 1; then
		echo "Setup emacs"
		return
	fi
	emacs_tmp=$dir_tmp/.emacs.d

	cp -r $files/.emacs.d $dir_tmp

	sed 's/(getenv "USER")/"'$login'"/g' $emacs_tmp/epitech/std_comment.el > $emacs_tmp/epitech/std_comment.el.tmp
	mv $emacs_tmp/epitech/std_comment.el.tmp $emacs_tmp/epitech/std_comment.el

	cp $files/.emacs /home/$USER/
	chmod +rw /home/$USER/.emacs

	cp -r $emacs_tmp /home/$USER/
	chmod +rw /home/$USER/.emacs.d
	chmod +rw /home/$USER/.emacs.d/*
}

if test $UID -eq 0; then
	echo ">> Ne pas lancer ce script en tant que sudo <<"
	usage
	exit 1
fi
if test -z "$login"; then
	usage
	exit 1
fi

script_init

script_header "INSTALLATION DE BLIH"
script_install blih

script_header "MISE À JOUR DES PAQUETS DU SYSTÈME"
sys_upgrade

script_header "INSTALLATION DE PYTHON3"
sys_install python3

script_header "INSTALLATION DE EMACS ET DU SYSTÈME DE HEADERS EPITECH"
sys_install emacs
setup_emacs

script_header "INSTALLATION DE GCC"
sys_install gcc

script_header "INSTALLATION DE MAKE"
sys_install make

script_header "INSTALLATION DE VALGRIND"
sys_install valgrind

script_header "INSTALLATION DE OCAML"
sys_install ocaml

script_header "INSTALLATION DE G++"
sys_install g++

script_header "INSTALLATION DE CURL"
sys_install curl

script_header "INSTALLATION DE GIT, GENERATION DE LA CLE SSH ET UPLOAD SUR SERVEUR EPITECH"

script_header "GIT" $C_YELLOW
sys_install git

script_header "CLE SSH, LEAVE EVERYTHING AS DEFAULT" $C_YELLOW
ssh-keygen
handle_error $?

script_header "BLIH SSH UPLOAD" $C_YELLOW
echo "mot de passe UNIX (bocal, pour blih)"
blih -u "$1" sshkey upload /home/$USER/.ssh/id_rsa.pub
handle_error $?

script_header "INSTALLATION ET CONFIGURATION DE ZSH ET OH MY ZSH"

script_header "ZSH" $C_YELLOW
sys_install zsh

script_header "OH-MY-ZSH" $C_YELLOW
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#no error check here: remote install.sh has a chsh error
chsh $USER -s /usr/bin/zsh
handle_error $?
echo "alias blih='blih -u $1'" >> /home/$USER/.zshrc
echo "alias ns_auth='ns_auth -u $1'" >> /home/$USER/.zshrc

script_header "INSTALLATION DU MAN DE GOOGLE"
sudo cp $files/google.1 /usr/share/man/man1/google.1
handle_error $?

script_header "INSTALLATION DE TERMINATOR"
sys_install terminator

script_header "INSTALLATION DES OUTILS COMPLEMENTAIRES"
sys_install tree
sys_install filezilla

script_header "CHANGEMENT DES DROITS (-) SUR POWEROFF ET REBOOT"
sudo chmod +s /sbin/poweroff
handle_error $?
sudo chmod +s /sbin/reboot
handle_error $?

script_header "DESIREZ VOUS INSTALLER MAKEFILE-GEN ?"
read -p "Installer makefile-gen pour générer vos makefiles ? [O/n]" yn
case $yn in
    [Nn]* );;
    * ) sys_install ruby; git clone https://github.com/kayofeld/makefile-gen.git; cd makefile-gen; sudo ./install.sh; cd ../;;
esac


script_header "EFFACEMENT DES FICHIERS D'INSTALLATION"
rm -rvf ../installation

script_header "VOTRE OS EST PRÊT POUR EPITECH" $C_BWHITE

sudo -k

Installation fails in OpenSuse (Windows Linux Subsystem)

Hi,

The installation fails on OpenSuse (in Windows Linux Subsystem) because of the -y option in both zypper commands (zypper update and zypper install).
To fix it, you'll have to delete the -y option and validate each installation step by typing "y" on the prompt.

More options & minimalist approach

Hi,

It would be nice to have more options like vim instead of emacs or fish instead of zsh (or simply bash depending on the peoples this is aimed on).
It could encourage diversity and avoid people using emacs "just because it was the default", for example.

Also, not everybody needs filezilla, it might be wise to have a minimal core and suggest totally optional parts, allowing peoples to go with the minimal stuff (and still know some options to expand their installation with) or take the full package, according to their needs and preferences.

Overall, I think it would encourage people to try for themselves, which would be great but again, it highly depends on the aim of this script.

[email protected]: Permission denied (public key)

Salut !
Tout d'abord merci aux auteurs de ce script vraiment pratique !

Je viens vers vous car j'ai un souci que je n'avais pas avant avec ce script.
Le problème survient lorsque je souhaite cloner un repo crée précédemment avec mes identifiants sur Blih.
Il me sort justement l'erreur en titre de cette issue.
Je souhaite préciser que je viens de ré-installer Antergos hier et tout fonctionnait auparavant.

J'ai beau reconfigurer ma clé SSH manuellement, toujours le même souci... toujours étudiant, Epitech ne m'a pas restreint les droits ^^

Message d'erreur complet:

The authenticity of host 'git.epitech.eu (163.5.xx.x)' can't be established.
ECDSA key fingerprint is SHA256:yNybv6JvwxvNE8jFqdIXYGgl3fA2qUdliq30CjSeYYx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'git.epitech.eu,163.5.xx.x' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Impossible de lire le dépôt distant.

J'imagine que ce problème est connu mais je n'ai toujours pas trouvé de solutions...

Suggestion: CSFML

Bonjour,
Epitech ayant un dump sous fedora, le script d'installation CSFML (en piece jointe) est fait pour le dump Epitech (fedora donc).

Donc je suggère simplement d'ajouter CSFML en plus du reste :)
Merci bien.

build_csfml.zip

Choose what to do at run-time

It would be nice to have the choice when running the script on what to do:
something like:

Update whole system ? Y/n
---
Update/Install BLIH ? Y/n
...
[and so on]

This would be really useful, especially when the connection is low (about 90% of the time) and you just want to update emacs configuration.

Problème script

Bonjour,

J'ai clone le repo, je fais le commande : ./install [email protected]
Et il ne reconnait l'argument avec mon login, donc je le mets entre guillemet et ça fait exactement pareil.
Donc je fais comme l'exemple : ./install [email protected]
Et là il me met : -bash: syntax error near unexpected token `newline'
Donc comment je fais ? J'ai besoin de donner les droits sur un repo et je suis sous windows avec le Bash ubuntu d'installer, avant de redump ça fonctionnait mais là non...

Merci d'avance !

epitech header emacs archlinux

pressed ^C^H,
entered project name
entered project description
Error on minibuffer:
Symbol’s function definition is void: insert-string

Hope it gets fixed soon, because copying a file then removing content and changing file name and description is annoying.

Header emacs

Hi, I'm currently in Epitech in tek-1, I just wanted you to know that we don't use the login form : "123456_1". We now use the format "[email protected]". If you can change it, that would be appreciated.
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.