workflow/initialization/init_workflow.sh

142 lines
3.7 KiB
Bash
Raw Normal View History

2023-07-08 10:57:36 +02:00
#!/bin/bash
#
# mise en place du workflow
#
2023-08-15 22:23:40 +02:00
echo "========== init de workflow par Tykayn ======="
2023-08-15 22:50:45 +02:00
source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh
2023-08-15 22:23:40 +02:00
2023-08-15 22:53:03 +02:00
bash $WORKFLOW_PATH_PUBLIC/initialisation/partials/check_foler_integrity.sh
bash $WORKFLOW_PATH_PUBLIC/initialisation/partials/git_config_glob.sh
2023-08-15 22:23:40 +02:00
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"
2023-08-15 22:50:45 +02:00
sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/tk_softwares.yml"
2023-08-15 22:23:40 +02:00
2023-08-15 22:50:45 +02:00
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"
2023-08-15 22:23:40 +02:00
2023-08-15 22:50:45 +02:00
ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow.yml"
sudo ansible-playbook "$WORKFLOW_PATH_PUBLIC/automatisation/ansible/cronjob_workflow_root.yml"
2023-08-15 22:23:40 +02:00
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
2023-08-15 22:35:32 +02:00
# yarn
corepack enable
npm i -g pnpm
2023-08-15 22:23:40 +02:00
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
2023-08-15 22:50:45 +02:00
# bash $WORKFLOW_PATH_PUBLIC/update_git_projects.sh
2023-08-15 22:23:40 +02:00
echo "ajouter dans la crontab utilisateur le script cronjob_nextcloud.sh"
echo "# toutes les 5 minutes
2023-08-15 22:50:45 +02:00
#*/5 * * * * bash $WORKFLOW_PATH_PUBLIC/cronjob_nextcloud.sh
2023-08-15 22:23:40 +02:00
# 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
bash "$WORKFLOW_PATH"/files_management/install.sh
bash "$WORKFLOW_PATH"/install/git_config_glob.sh
bash "$WORKFLOW_PATH"/refresh_from_current_assets.sh
2023-08-15 22:35:32 +02:00
sudo apt update -y
sudo apt upgrade -y