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
|
||||
# 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,15 +63,14 @@ 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
|
||||
### No .git.update flag file exists
|
||||
|
||||
### Update all repositories with mr
|
||||
mr update
|
||||
|
||||
### Create a flag file to know the last update time
|
||||
touch "${HOME}"/.git.update
|
||||
fi
|
||||
fi
|
||||
## }}}
|
||||
|
||||
# Create symlinks
|
||||
|
|
Loading…
Reference in New Issue