diff --git a/initialization/init_workflow.sh b/initialization/init_workflow.sh index fae84ef..062f4c3 100644 --- a/initialization/init_workflow.sh +++ b/initialization/init_workflow.sh @@ -5,138 +5,24 @@ echo "========== init de workflow par Tykayn =======" source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh -bash $WORKFLOW_PATH_PUBLIC/initialisation/partials/check_foler_integrity.sh -bash $WORKFLOW_PATH_PUBLIC/initialisation/partials/git_config_glob.sh - -if ! hash ansible > /dev/null; then - echo "* installation de Ansible" - sudo apt install ansible python3-pip -fi -####### lancement des playbooks ansible pour initialisation -ansible-galaxy install coglinev3.veracrypt - -echo "vérification et installation des paquets requis" -sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/tk_softwares.yml" - - -ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/pip_modules.yml" -sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/snaps.yml" -ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/node_packages.yml" - -ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow.yml" -sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow_root.yml" - -sudo apt autoremove -y - -############ install developping tools - - -# nvm node version manager -if ! hash nvm > /dev/null; then - echo "installation de nvm" - - cd tmp - echo "install nvm" - - wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash -fi - - -nvm install $node_version_expected -nvm alias default $node_version_expected -nvm alias global $node_version_expected - -# yarn -corepack enable -npm i -g pnpm - - echo "nvm installé, version des outils js:" -nvm --version -node --version -yarn --version - -echo "install des outils en php" - -# composer php -# symfony cli tool -# créer le dossier de scripts -if ! hash symfony ; then - wget https://get.symfony.com/cli/installer -O - | bash -fi - -if ! hash composer ; then - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" - - if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] - then - >&2 echo 'ERROR: Invalid installer checksum' - rm composer-setup.php - exit 1 - fi - - php composer-setup.php --quiet - RESULT=$? - rm composer-setup.php - - sudo mv composer.phar /usr/local/bin/composer -fi - - - - -############## java pour josm -if ! hash java ; then - sudo apt install java -y -fi - -if ! hash javaws; then - cd tmp - wget https://github.com/karakun/OpenWebStart/releases/download/v1.7.0/OpenWebStart_linux_1_7_0.deb - sudo dpkg -i OpenWebStart_linux_1_7_0.deb - rm -rf OpenWebStart_linux_1_7_0.deb - -fi - -if ! hash josm ; then - mkdir -p ~/areas/www/misc/josm - cd ~/areas/www/misc/josm - - wget https://josm.openstreetmap.de/download/josm.jnlp - - sudo apt install josm -y -fi - - +bash "$WORKFLOW_PATH_PUBLIC/initialisation/partials/check_foler_integrity.sh" +bash "$WORKFLOW_PATH_PUBLIC/initialisation/partials/git_config_glob.sh" +bash "$WORKFLOW_PATH_PUBLIC/initialisation/partials/ansible.sh" +bash "$WORKFLOW_PATH_PUBLIC/initialisation/partials/dev_tools.sh" +bash "$WORKFLOW_PATH_PUBLIC/initialisation/partials/java-josm.sh" # bash $WORKFLOW_PATH_PUBLIC/update_git_projects.sh -echo "ajouter dans la crontab utilisateur le script cronjob_nextcloud.sh" -echo "# toutes les 5 minutes -#*/5 * * * * bash $WORKFLOW_PATH_PUBLIC/cronjob_nextcloud.sh -# vérifiez avec la commande -crontab -e -" # copier quelques fichiers de config dans la home -cp "$WORKFLOW_PATH"/install/.zshrc ~/ -cp "$WORKFLOW_PATH"/install/.bash_aliases ~/ -cp "$WORKFLOW_PATH"/install/.bashrc ~/ - -if ! -d ~/.oh-my-zsh; then - echo "installer oh my zsh" - cd - sudo apt install zsh - sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" -fi - - +cp "$WORKFLOW_PATH/install/.zshrc" "~/" +cp "$WORKFLOW_PATH/install/.bash_aliases" "~/" +cp "$WORKFLOW_PATH/install/.bashrc" "~/" bash "$WORKFLOW_PATH"/files_management/install.sh bash "$WORKFLOW_PATH"/install/git_config_glob.sh bash "$WORKFLOW_PATH"/refresh_from_current_assets.sh sudo apt update -y -sudo apt upgrade -y \ No newline at end of file +sudo apt upgrade -y +sudo apt autoremove -y diff --git a/initialization/partials/ansible.sh b/initialization/partials/ansible.sh new file mode 100644 index 0000000..2c19936 --- /dev/null +++ b/initialization/partials/ansible.sh @@ -0,0 +1,28 @@ +#!/bin/bash +echo " ------ install ansible playbooks ------" + +if ! hash ansible > /dev/null; then + echo "* installation de Ansible" + sudo apt install ansible python3-pip +fi +####### lancement des playbooks ansible pour initialisation +ansible-galaxy install coglinev3.veracrypt + +echo "vérification et installation des paquets requis" +sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/tk_softwares.yml" + + +ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/pip_modules.yml" +sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/snaps.yml" +ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/node_packages.yml" + +ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow.yml" +sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow_root.yml" + + +#echo "ajouter dans la crontab utilisateur le script cronjob_nextcloud.sh" +#echo "# toutes les 5 minutes +## */5 * * * * bash $WORKFLOW_PATH_PUBLIC/cronjob_nextcloud.sh + + + diff --git a/initialization/partials/dev_tools.sh b/initialization/partials/dev_tools.sh new file mode 100644 index 0000000..2cdccd5 --- /dev/null +++ b/initialization/partials/dev_tools.sh @@ -0,0 +1,62 @@ +#!/bin/bash +echo " ------ install developing tools ------" + + +############ install developping tools + + +# nvm node version manager +if ! hash nvm > /dev/null; then + echo "installation de nvm" + + cd tmp + echo "install nvm" + + wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash +fi + + +nvm install $node_version_expected +nvm alias default $node_version_expected +nvm alias global $node_version_expected + +# yarn +corepack enable +npm i -g pnpm + + echo "nvm installé, version des outils js:" +nvm --version +node --version +yarn --version + + +echo "install des outils en php" + +# composer php +# symfony cli tool +# créer le dossier de scripts +if ! hash symfony ; then + wget https://get.symfony.com/cli/installer -O - | bash +fi + +if ! hash composer ; then + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')" + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + + if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] + then + >&2 echo 'ERROR: Invalid installer checksum' + rm composer-setup.php + exit 1 + fi + + php composer-setup.php --quiet + RESULT=$? + rm composer-setup.php + + sudo mv composer.phar /usr/local/bin/composer +fi + + diff --git a/initialization/partials/java-josm.sh b/initialization/partials/java-josm.sh new file mode 100644 index 0000000..9ff835d --- /dev/null +++ b/initialization/partials/java-josm.sh @@ -0,0 +1,26 @@ +#!/bin/bash +echo " ------ install java and josm ------" + +############## java pour josm +if ! hash java ; then + sudo apt install java -y +fi + +if ! hash javaws; then + cd tmp + wget https://github.com/karakun/OpenWebStart/releases/download/v1.7.0/OpenWebStart_linux_1_7_0.deb + sudo dpkg -i OpenWebStart_linux_1_7_0.deb + rm -rf OpenWebStart_linux_1_7_0.deb + +fi + +if ! hash josm ; then + mkdir -p ~/areas/www/misc/josm + cd ~/areas/www/misc/josm + + wget https://josm.openstreetmap.de/download/josm.jnlp + + sudo apt install josm -y +fi + + diff --git a/initialization/partials/zsh.sh b/initialization/partials/zsh.sh new file mode 100644 index 0000000..30e7402 --- /dev/null +++ b/initialization/partials/zsh.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo " ------ install oh my zsh ------" +if ! -d ~/.oh-my-zsh; then + echo "installer oh my zsh" + cd + sudo apt install zsh + sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" +fi