Download default mrconfig file if unavailable
This commit is contained in:
parent
d8c10787fd
commit
5c73d22620
26
profile
26
profile
|
@ -1,5 +1,7 @@
|
||||||
# Default .profile from gardouille.home_public
|
# Ansible managed
|
||||||
# https://git.101010.fr/gardouille-dotfiles/home_public
|
|
||||||
|
# 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 {{{
|
# Manage dependencies {{{
|
||||||
## Ensure to have git {{{
|
## Ensure to have git {{{
|
||||||
|
@ -37,21 +39,18 @@ REPO_PATH="${HOME}/${REPO_DIR}"
|
||||||
|
|
||||||
[ ! -d "${REPO_PATH}" ] && mkdir -p -- "${REPO_PATH}"
|
[ ! -d "${REPO_PATH}" ] && mkdir -p -- "${REPO_PATH}"
|
||||||
|
|
||||||
# If .mrconfig file is available and no mr command was already launch (eg: .tmux directory unavailable) {{{
|
# If no .mrconfig file is available {{{
|
||||||
if [ -f "${HOME}"/.mrconfig ] && [ ! -L "${HOME}"/.tmux ]; then
|
if [ ! -f "${HOME}"/.mrconfig ]; then
|
||||||
|
## Download a basic one
|
||||||
## Get all repositories with mr
|
wget --quiet https://git.101010.fr/gardouille-dotfiles/home_public/raw/branch/master/mrconfig -O "${HOME}"/.mrconfig
|
||||||
mr checkout
|
|
||||||
|
|
||||||
## Add a flag file to know the last update time
|
|
||||||
touch "${HOME}"/.git.update
|
|
||||||
fi
|
fi
|
||||||
# }}}
|
# }}}
|
||||||
# Update repositories {{{
|
# Update repositories {{{
|
||||||
|
|
||||||
## If a git.update flag exists
|
## If a .git.update flag file already exists
|
||||||
if [ -f "${HOME}"/.git.update ]; then
|
if [ -f "${HOME}"/.git.update ]; then
|
||||||
|
|
||||||
|
### Get the date of the last update
|
||||||
DATE_MTIME_GIT_FLAG=$(stat --format='%Y' "${HOME}"/.git.update)
|
DATE_MTIME_GIT_FLAG=$(stat --format='%Y' "${HOME}"/.git.update)
|
||||||
DATE_MAX=$(date --date="2 months ago" "+%s")
|
DATE_MAX=$(date --date="2 months ago" "+%s")
|
||||||
|
|
||||||
|
@ -64,14 +63,13 @@ if [ -f "${HOME}"/.git.update ]; then
|
||||||
touch "${HOME}"/.git.update
|
touch "${HOME}"/.git.update
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
## Otherwise, just try to update if minimum configuration is available
|
### No .git.update flag file exists
|
||||||
if [ -f "${HOME}"/.mrconfig ]; then
|
|
||||||
### Update all repositories with mr
|
### Update all repositories with mr
|
||||||
mr update
|
mr update
|
||||||
|
|
||||||
### Create a flag file to know the last update time
|
### Create a flag file to know the last update time
|
||||||
touch "${HOME}"/.git.update
|
touch "${HOME}"/.git.update
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue