update of assets from refresh script

This commit is contained in:
Tykayn 2023-02-17 12:27:17 +01:00 committed by tykayn
parent 9b9fd8d3d6
commit 39bd006a7c
13 changed files with 387 additions and 15 deletions

View File

@ -0,0 +1,15 @@
# Workflow avec Nextcloud
Gérer ses flux de travaux et autres gestion de projets avec des scripts.
J'unifie le comportement de mes stations de travail avec une gestion syncronisée de certains scripts pemettant d'installer certains programmes avec des configurations par défaut.
Ce dossier doit être présent dans votre dossier nextcloud,
idéalement dans:
```
~/Nextcloud/ressources/workflow_nextcloud
```
# débuter
Configrer les variables, puis ancer le script d'initialisation
```bash
bash ~/Nextcloud/ressources/workflow_nextcloud/init_workflow_tykayn.sh
```

View File

@ -0,0 +1,8 @@
[webservers]
localhost
proxmox.coussinet.org
peertube.cipherbliss.com
www.cipherbliss.com
192.168.1.2
192.168.1.15
bbb.liness.org

View File

@ -0,0 +1,7 @@
- name: cronjob pour le workflow nextcloud toutes les 5 minutes
hosts: localhost
tasks:
ansible.builtin.cron:
name: "backup nextcloud things"
minute: "*/5"
job: "/bin/bash ~/Nextcloud/ressources/workflow_nextcloud/cronjob_nextcloud.sh"

View File

@ -0,0 +1,53 @@
- name: installer des programmes utiles avec apt
hosts: localhost
become: yes
become_user: root
vars:
server_name: localhost
tasks:
- name: ensure latest version of main tools is installed on a headless computer
apt:
state: present
name:
- arp-scan
- borgbackup
- curl
- docker
- docker-compose
- etckeeper
- git
- gnupg
- jq
- meld
- nano
- ncdu
- nginx
- npm
- pandoc
- php
- python3
- python3-pip
- tig
- zsh
- veracrypt
- testdisk
- htop
- btop
- python3-pip
- python3-setuptools
- autopostgresqlbackup
- automysqlbackup
- certbot
- smartmontools
- fail2ban
- snapd
- unattended-upgrades
- php
- php-fpm
- php-xml
- php-mysql
- rsync
- php-dom
- php-curl
- vrms
- syncthing

View File

@ -0,0 +1,31 @@
# Install snaps
- name: Install "emacs" with option --classic
community.general.snap:
name: emacs
classic: true
- name: Install "blender" with option --classic
community.general.snap:
name: blender
classic: true
- name: Install "rambox" with option --classic
community.general.snap:
name: rambox
classic: true
- name: Install "thunderbrid" with option --classic
community.general.snap:
name: thunderbrid
classic: true
- name: Install "tor-mkg20001"
community.general.snap:
name: tor-mkg20001
# python packages
- name: Install guessfilename
ansible.builtin.pip:
name: guessfilename
extra_args: --user

View File

@ -0,0 +1,70 @@
- name: installer des programmes utiles avec apt
hosts: localhost
become: yes
become_user: root
vars:
server_name: localhost
tasks:
- name: ensure latest version of main tools for desktop is installed
apt:
state: present
name:
- arp-scan
- audacity
- baobab
- borgbackup
- curl
- docker
- dolphin
- thunar
- docker-compose
- etckeeper
- gajim
- geeqie
- gimp
- git
- gpa
- gnupg
- grsync
- jq
- kdenlive
- keepassxc
- konsole
- krita
- krita-l10n
- meld
- nano
- ncdu
- nginx
- npm
- pandoc
- php
- python3
- python3-pip
- terminator
- tig
- transmission
- ufw
- zsh
- veracrypt
- testdisk
- htop
- btop
- python3-pip
- python3-setuptools
- autopostgresqlbackup
- automysqlbackup
- certbot
- smartmontools
- fail2ban
- snapd
- unattended-upgrades
- php
- php-fpm
- php-xml
- php-mysql
- rsync
- php-dom
- php-curl
- vrms
- klavaro

View File

@ -4,8 +4,9 @@
# tâche à effectuer régulièrement sur les ordis portables # tâche à effectuer régulièrement sur les ordis portables
# #
# @author functions_sync by @tykayn - contact at cipherbliss.com # @author functions_sync by @tykayn - contact at cipherbliss.com
source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
# récupérer les notes du mobile et les stocker dans l'incoming inbox orgmode # récupérer les notes du mobile et les stocker dans l'incoming inbox orgmode
bash ~/Nextcloud/ressources/workflow_nextcloud/update_calendar.sh bash $WORKFLOW_PATH/update_calendar_tkwulfi.sh
bash ~/Nextcloud/ressources/workflow_nextcloud/get_nextcloud_notes_todo.sh bash $WORKFLOW_PATH/get_nextcloud_notes_todo.sh
bash ~/Nextcloud/ressources/workflow_nextcloud/backup_nextcloud_in_user_home.sh bash $WORKFLOW_PATH/backup_nextcloud_in_user_home.sh

View File

@ -0,0 +1,68 @@
#/bin/bash
# @author script by @tykayn - contact at cipherbliss.com
# rafraîchir les assets du dépot d'example versionné avec ceux couramment utilisés.
# à installer sur un ordi que l'on utilise en tant que référence d'assets
# à installer en cronjob avec:
# crontab -e
#
# m h dom mon dow command
# */30 * * * * bash /home/tykayn/www/scripts/refresh_from_current_assets.sh
# configs
source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
echo "mise à jour des assets de référence dans les scripts custom $HOME_OF_SCRIPTS depuis l'ordinateur actuel"
if [ ! -d $HOME_OF_SCRIPTS ]; then
mkdir -p $HOME_OF_SCRIPTS
git clone https://forge.chapril.org/tykayn/scripts $HOME_OF_SCRIPTS
fi
# bouger le dossier www
if [ -d $HOME/www ]; then
echo "déplacement du dossier $HOME/www dans $www_folder"
mv $HOME/www/* $www_folder
fi
# orgmode
echo " "
echo "copie de config emacs vers le dossier $HOME_OF_SCRIPTS"
cp "$WORKFLOW_PATH/.emacs" "$HOME_OF_SCRIPTS/assets/org" -r
cp "$orgmode_path/config.org" "$HOME_OF_SCRIPTS/assets/org" -r
cp "$orgmode_path/style.css" "$HOME_OF_SCRIPTS/assets/org" -r
cp "$WORKFLOW_PATH/update_calendar.sh" "$HOME_OF_SCRIPTS/assets/org" -r
# sauvegardes
cp "$HOME/test-func.sh" "$HOME_OF_SCRIPTS/bash/backups"
cp "$WORKFLOW_PATH/workflow_variables.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/init_workflow_nextcloud.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/cronjob_nextcloud.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/git_autocommit.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/update_calendar.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/README.md" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/refresh_from_current_assets.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/update_git_projects.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/"
cp "$WORKFLOW_PATH/sync_spaceship.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud"
cp "$WORKFLOW_PATH/functions_sync.sh" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud"
cp -r "$WORKFLOW_PATH/ansible/*" "$HOME_OF_SCRIPTS/bash/workflow_nextcloud/ansible"
cd $HOME_OF_SCRIPTS
git status
echo " "
echo "copie de des fichiers d'alias vers la home utilisateur"
# workflow things
cp "$WORKFLOW_PATH/install/.bash_aliases" ~/
cp "$WORKFLOW_PATH/install/.bash_custom_aliases" ~/
cp "$WORKFLOW_PATH/install/.bashrc" ~/
cp "$WORKFLOW_PATH/install/.zshrc" ~/
cp "$WORKFLOW_PATH/install/.emacs" ~/
echo "HOME_OF_SCRIPTS : $HOME_OF_SCRIPTS"
ls -l "$HOME_OF_SCRIPTS/assets/org"
cd $HOME_OF_SCRIPTS
git add .
git commit -m "update of assets from refresh script"
git push origin

View File

@ -12,7 +12,7 @@
# crontab -e # crontab -e
# #
# m h dom mon dow command # m h dom mon dow command
# */30 * * * * bash ~/Nextcloud/ressources/workflow_nextcloud/sync_spaceship.sh # */30 * * * * bash ~/sync_spaceship.sh
# #
# ----------------- configs ----------------- # ----------------- configs -----------------
# functions_sync.sh définit les constantes utiles # functions_sync.sh définit les constantes utiles
@ -35,8 +35,8 @@ cp ~/.emacs $ARCHIVE_SYNCABLE/archivage/__scripts_syncro
cp ~/Nextcloud/ressources/workflow_nextcloud/sync_spaceship.sh $ARCHIVE_SYNCABLE/archivage/__scripts_syncro cp ~/Nextcloud/ressources/workflow_nextcloud/sync_spaceship.sh $ARCHIVE_SYNCABLE/archivage/__scripts_syncro
cp ~/.bash_aliases ~/Nextcloud/ressources/workflow_nextcloud/install #cp ~/.bash_aliases ~/Nextcloud/ressources/workflow_nextcloud/install
cp ~/.emacs ~/Nextcloud/ressources/workflow_nextcloud/install #cp ~/.emacs ~/Nextcloud/ressources/workflow_nextcloud/install
echo ' ' >> $LOG_FILE_BACKUP_DATES echo ' ' >> $LOG_FILE_BACKUP_DATES
echo "### ${today} start backup script from sync_spaceship script" >> $LOG_FILE_BACKUP_DATES echo "### ${today} start backup script from sync_spaceship script" >> $LOG_FILE_BACKUP_DATES
@ -51,11 +51,13 @@ dpkg --get-selections>~/list_of_debian_apt_packages.txt
# back pictures to ARCHIVE_SYNCABLE # back pictures to ARCHIVE_SYNCABLE
logDate 'copy of Nextcloud InstantUpload photos' logDate 'copy of Nextcloud InstantUpload photos'
mv /home/tykayn/Nextcloud/inbox/instantUpload "$ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" | tee -a $LOG_FILE_BACKUP 2>&1
mv ~/Nextcloud/InstantUpload/Camera/* "$ARCHIVE_SYNCABLE/photos/a dispatcher" | tee -a $LOG_FILE_BACKUP 2>&1
mv ~/Nextcloud/inbox/instantUpload/* "$ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" | tee -a $LOG_FILE_BACKUP 2>&1 mv ~/Nextcloud/inbox/instantUpload/* "$ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" | tee -a $LOG_FILE_BACKUP 2>&1
echo ' ' >> $LOG_FILE_BACKUP_DATES echo ' ' >> $LOG_FILE_BACKUP_DATES
echo "### ${today} medias in $ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" >> $LOG_FILE_BACKUP_DATES echo "### ${today} medias in $ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" >> $LOG_FILE_BACKUP_DATES
ls -l "$ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" | wc -l | tee -a $LOG_FILE_BACKUP 2>&1 ls -l "$ARCHIVE_SYNCABLE/photos/$CURRENT_YEAR" | wc -l | tee -a $LOG_FILE_BACKUP 2>&1
logDate ' Screenshots et Download' logDate ' Screenshots et Download'
mv ~/Nextcloud/inbox/InstantUpload/Screenshots/* "$ARCHIVE_SYNCABLE/photos/screenshots" | tee -a $LOG_FILE_BACKUP 2>&1 mv ~/Nextcloud/inbox/InstantUpload/Screenshots/* "$ARCHIVE_SYNCABLE/photos/screenshots" | tee -a $LOG_FILE_BACKUP 2>&1
@ -67,7 +69,7 @@ rsync -avhWP --perms --inplace --delete-before ~/Nextcloud/* $ARCHIVE_SYNCABLE/a
# --------- copier la home dans les archives ------------ # --------- copier la home dans les archives ------------
logDate 'update home backup'; logDate 'update home backup';
rsync -avhWP --inplace --delete-before ~/* /home/poule/encrypted/stockage-syncable/archivage/home "${exclude_opts[@]}" --exclude 'Nextcloud' --exclude 'www' | tee -a $LOG_FILE_BACKUP 2>&1 rsync -avhWP --inplace --delete-before ~/* /home/poule/encrypted/stockage-syncable/archivage/home "${exclude_opts[@]}" --exclude 'Nextcloud' --exclude 'www' --exclude 'VirtualBox VMs' | tee -a $LOG_FILE_BACKUP 2>&1
# --------- sauver les dossiers de développement dans l'archive stockage syncable sans supprimer les projets présents -------- # # --------- sauver les dossiers de développement dans l'archive stockage syncable sans supprimer les projets présents -------- #

View File

@ -1,17 +1,24 @@
#!/bin/bash #!/bin/bash
# getting a nextcloud calendar without auth and convert it to org file # getting a nextcloud calendar without auth and convert it to org file
# add this to a cronjob # add this to a cronjob
# nécessite icsorg, installable par : #
# npm install icsorg -g
echo "updating calendar from nextcloud" echo "updating calendar from nextcloud"
#URL="https://cloud.tykayn.fr/remote.php/dav/public-calendars/ABCDEFFFFFFFFFFFFFFF\?export" # public link to orgmode calendar of nextcloud https://cloud.tykayn.fr/index.php/apps/calendar/timeGridWeek/now # public link to orgmode calendar of nextcloud https://cloud.tykayn.fr/index.php/apps/calendar/timeGridWeek/now
#URL="https://cloud.tykayn.fr/remote.php/dav/public-calendars/abcdeffffffffffffffffff\?export"
URL_CAL="https://nuage.tykayn.fr/remote.php/dav/public-calendars/ABCDEFFFFFFFFFFFFFFF?export" # calendrier partagé URL_CAL="https://nuage.tykayn.fr/remote.php/dav/public-calendars/cHkSk5rG445MftpZ?export" # calendrier tkwulfi
echo $URL_CAL echo $URL_CAL
wget $URL_CAL -O orgcalendar.ics --show-progress wget $URL_CAL -O orgcalendar.ics --show-progress
# add content of other calendars
#URL_CAL="https://cloud.tykayn.fr/remote.php/dav/calendars/super_admin_tykayn/mobilizonfr/?export"
#wget $URL_CAL -O ->> orgcalendar.ics --show-progress
# annivs
#URL_CAL="https://cloud.tykayn.fr/remote.php/dav/calendars/super_admin_tykayn/contact_birthdays/?export"
#wget $URL_CAL -O ->> orgcalendar.ics --show-progress
# convert the ics to an org file
du -sch orgcalendar.ics du -sch orgcalendar.ics
icsorg -i orgcalendar.ics -o calendar.org -p 999999 icsorg -i orgcalendar.ics -o calendar.org -p 999999
cat calendar.org |wc -l cat calendar.org |wc -l

View File

@ -0,0 +1,85 @@
#!/bin/bash
#####################################################
# author: @tykayn@mastodon.cipherbliss.com
# website: https://www.cipherbliss.com
#
# update all listed git projects in the home folder/www
# list of framagit repos to clone. Run this command to make it work
# ------------------------------------------------------------------------------------------------
#
# cd ~/Téléchargements
# curl -s https://forge.chapril.org/tykayn/scripts/raw/branch/master/update_git_projects.sh | bash
#
# ------------------------------------------------------------------------------------------------
#####################################################
source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
######################################################
# liste de tous les projets pour chaque forge logicielle
#####################################################
declare -a list_repos_framagit=("caisse-bliss" "joinfediverse" "date-poll-api" "mastodon" "peertube" "events-liberator" "gitall" "dotclear-importer" "mobilizon" "fanzine-log" "crossed-words" "generator-tk" "circles" "card-deck" "sfprobe" "mastermind" "portfolio" "time-tracker" "cipherbliss.com" "caisse-bliss-frontend" "compta" "trafficjam" "ical-generator" "blueprint-cipherbliss" "dotclear2wordpress" "api" "diaspora" )
declare -a list_repos_forge_chapril=("transcription" "org-report-stats" "multi-account-post-schedule-mastodon" "framalibre-scraping" "scripts" "melting-pot" "funky-framadate-front" "rss-feeder-mobilizon" "mastodon-archive-stats" "gtg2json" "libreavous-audio-reader" "osm_my_commerce" "fromage-js" "ueberauth_openstreetmap" "events-liberator")
prefix_framagit='https://framagit.org/tykayn/'
prefix_forgechapril='https://forge.chapril.org/tykayn/'
cloning_place=$www_folder
cd $cloning_place
pwd
# fonction qui prend une url de base et une liste de noms de dépots à cloner
# si vous trouvez comment passer facilement un array en argument à une fonction bash, go faire la fonction pour que l'on puisse faire " pullOrCreateRepo base_url liste_de_dépots"
#function pullOrCreateRepo(){
#}
#####################################################
# tout ceci est très verbeux.
# fonctionnement:
# lancer les clonages et git pull sur chaque dépot
# test existence of a folder
# if there is no folder, clone it
# else, update with fetch from origin
#####################################################
echo "----------- from framagit"
for project_name in "${list_repos_framagit[@]}";
do
cd $cloning_place
if [ ! -d "$project_name" ]
then
echo "+++++ cloning ${project_name}"
echo "from ${prefix_framagit}${project_name}.git"
git clone "${prefix_framagit}${project_name}.git"
else
echo "##### update project $project_name"
cd $cloning_place$project_name
git fetch origin
git config pull.ff only
git pull
fi
done
echo "----------- from forge chapril"
for project_name in "${list_repos_forge_chapril[@]}";
do
cd $cloning_place
if [ ! -d "$project_name" ]
then
echo "+++++ cloning ${project_name}"
echo "from ${prefix_forgechapril}${project_name}.git"
git clone "${prefix_forgechapril}${project_name}.git"
else
echo "##### update project $project_name"
cd $cloning_place$project_name
git fetch origin
git config pull.ff only
git pull
fi
done
# vous pouvez ajouter vos autres dépots
cd $cloning_place
ls -l |wc -l
echo "update done"

View File

@ -1,5 +1,30 @@
#!/bin/bash #!/bin/bash
export workflow_path=~/Nextcloud/ressources/workflow_nextcloud/ # ajouter dans les scripts avec cette ligne:
#
# source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
#
#
export WORKFLOW_PATH=~/Nextcloud/ressources/workflow_nextcloud
export ALIASES_PATH=$WORKFLOW_PATH/install/.bash_custom_aliases
# fichiers orgmode, wiki personnel
export orgmode_path=~/Nextcloud/textes/orgmode export orgmode_path=~/Nextcloud/textes/orgmode
export inbox_orgmode=$orgmode_path/incoming_inbox.org
export orgroam_path=~/Nextcloud/textes/orgmode/org-roam export orgroam_path=~/Nextcloud/textes/orgmode/org-roam
export BORG_PASSCOMMAND="cat /home/$USER/.tk-borg-passphrase-light" export backup_texts_folder=~/archives/backup_automatique
export HOME_OF_SCRIPTS=$www_folder/scripts
# archives dans un pool zfs nommé poule
export stockage_syncable_folder=/home/poule/encrypted/stockage-syncable
# dossier où stocker les projets de dev
export www_folder=$HOME/areas/www
export node_version_expected=16
export today=`date` # to log current time
export ARCHIVE_SYNCABLE=$stockage_syncable_folder # place where we have our things sorted, other than home
export BORG_PASSCOMMAND="cat $ARCHIVE_SYNCABLE/.tk-borg-passphrase-light" # get the borg repo pass
export SPACESHIP_BORG_REPO="/home/poule/borg_archives/backup_land4to"
export LOG_FILE_BACKUP="$ARCHIVE_SYNCABLE/www/backup/log_backup.log"
# log dates of execution of the script
export LOG_FILE_BACKUP_DATES="$ARCHIVE_SYNCABLE/www/backup/summary_log_backup.log"