From 5c73d226200db487f0c968f8d5103892f26335fe Mon Sep 17 00:00:00 2001 From: Gardouille Date: Fri, 21 Jan 2022 12:23:16 +0100 Subject: [PATCH] Download default mrconfig file if unavailable --- profile | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/profile b/profile index aa54ea9..c6368c8 100644 --- a/profile +++ b/profile @@ -1,5 +1,7 @@ -# Default .profile from gardouille.home_public -# https://git.101010.fr/gardouille-dotfiles/home_public +# Ansible managed + +# For any permanent changes you must modify your own authorized_keys file under +# https://git.101010.fr/101010/debops/src/branch/master/ansible/resources/files/by-group/all/home/gardouille/.profile # Manage dependencies {{{ ## Ensure to have git {{{ @@ -37,21 +39,18 @@ REPO_PATH="${HOME}/${REPO_DIR}" [ ! -d "${REPO_PATH}" ] && mkdir -p -- "${REPO_PATH}" -# If .mrconfig file is available and no mr command was already launch (eg: .tmux directory unavailable) {{{ -if [ -f "${HOME}"/.mrconfig ] && [ ! -L "${HOME}"/.tmux ]; then - - ## Get all repositories with mr - mr checkout - - ## Add a flag file to know the last update time - touch "${HOME}"/.git.update +# If no .mrconfig file is available {{{ +if [ ! -f "${HOME}"/.mrconfig ]; then + ## Download a basic one + wget --quiet https://git.101010.fr/gardouille-dotfiles/home_public/raw/branch/master/mrconfig -O "${HOME}"/.mrconfig fi # }}} # Update repositories {{{ -## If a git.update flag exists +## If a .git.update flag file already exists if [ -f "${HOME}"/.git.update ]; then + ### Get the date of the last update DATE_MTIME_GIT_FLAG=$(stat --format='%Y' "${HOME}"/.git.update) DATE_MAX=$(date --date="2 months ago" "+%s") @@ -64,14 +63,13 @@ if [ -f "${HOME}"/.git.update ]; then touch "${HOME}"/.git.update fi else -## Otherwise, just try to update if minimum configuration is available - if [ -f "${HOME}"/.mrconfig ]; then - ### Update all repositories with mr - mr update + ### No .git.update flag file exists - ### Create a flag file to know the last update time - touch "${HOME}"/.git.update - fi + ### Update all repositories with mr + mr update + + ### Create a flag file to know the last update time + touch "${HOME}"/.git.update fi ## }}}