generated from me/template-mit
Fix the '$project' variable being shared across environments incorrectly.
This commit is contained in:
32
rc_shared.sh
32
rc_shared.sh
@@ -93,7 +93,7 @@ function update-shared-old {
|
|||||||
https://git.hyperling.com/me/shell-music-refactor-library/raw/branch/main/refactor_music_library.sh
|
https://git.hyperling.com/me/shell-music-refactor-library/raw/branch/main/refactor_music_library.sh
|
||||||
mv -v $refactor_script "$local_bin"/
|
mv -v $refactor_script "$local_bin"/
|
||||||
|
|
||||||
chmod 755 -Rv "$local_bin"
|
chmod 755 -Rc "$local_bin"
|
||||||
else
|
else
|
||||||
echo "Did not find '$local_bin', did not copy scripts."
|
echo "Did not find '$local_bin', did not copy scripts."
|
||||||
fi
|
fi
|
||||||
@@ -104,21 +104,21 @@ function update-shared-old {
|
|||||||
log "\n`date` - Complete!"
|
log "\n`date` - Complete!"
|
||||||
}
|
}
|
||||||
|
|
||||||
project="$HOME/.git-env-shared"
|
PROJECT_SHARED="$HOME/.git-env-shared"
|
||||||
function update-shared2 {
|
function update-shared2 {
|
||||||
if [[ -d $project ]]; then
|
if [[ -d $shared ]]; then
|
||||||
log "`date` - Updating '$project'.\n"
|
log "`date` - Updating '$PROJECT_SHARED'.\n"
|
||||||
git -C "$project" switch "$branch"
|
git -C "$PROJECT_SHARED" switch "$branch"
|
||||||
git -C "$project" pull --recurse-submodules || \
|
git -C "$PROJECT_SHARED" pull --recurse-submodules || \
|
||||||
( echo "Failed to pull project, exiting." && return 1 )
|
( echo "Failed to pull project, exiting." && return 1 )
|
||||||
else
|
else
|
||||||
log "`date` - Downloading '$project'.\n"
|
log "`date` - Downloading '$PROJECT_SHARED'.\n"
|
||||||
git clone https://git.hyperling.com/me/env-shared \
|
git clone https://git.hyperling.com/me/env-shared \
|
||||||
"$project" --branch=$branch
|
"$PROJECT_SHARED" --branch=$branch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local_bin="$HOME/bin"
|
local_bin="$HOME/bin"
|
||||||
remote_bin="$project/bin-shared"
|
remote_bin="$PROJECT_SHARED/bin-shared"
|
||||||
if [[ -d "$local_bin" ]]; then
|
if [[ -d "$local_bin" ]]; then
|
||||||
log "\n`date` - Found '$local_bin', adding scripts.\n"
|
log "\n`date` - Found '$local_bin', adding scripts.\n"
|
||||||
cp -v "$remote_bin"/*.sh "$local_bin"/
|
cp -v "$remote_bin"/*.sh "$local_bin"/
|
||||||
@@ -178,10 +178,10 @@ function update-all {
|
|||||||
}
|
}
|
||||||
alias all-update="update-all"
|
alias all-update="update-all"
|
||||||
|
|
||||||
project_old="$HOME/.env-shared"
|
PROJECT_SHARED_OLD01="$HOME/.env-shared"
|
||||||
if [[ -d "$project_old" ]]; then
|
if [[ -d "$PROJECT_SHARED_OLD01" ]]; then
|
||||||
log "`date` - Removing old project name '$project_old'."
|
log "`date` - Removing old project name '$PROJECT_SHARED_OLD01'."
|
||||||
mv -v "$project_old" "$TRASH"/env-shared-deleteme | grep -v ".git"
|
mv -v "$PROJECT_SHARED_OLD01" "$TRASH"/env-shared-deleteme | grep -v ".git"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Shortcuts #
|
# Shortcuts #
|
||||||
@@ -583,8 +583,10 @@ alias clean-trashed='find "$TRASH_ROOT" -name ".trashed*" -exec du -h {} \; -del
|
|||||||
eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
|
eval "$(declare -F | grep -v _ | sed 's/-f /-fx /')"
|
||||||
|
|
||||||
# Run update checker in background.
|
# Run update checker in background.
|
||||||
( if [[ -d "$project" ]]; then
|
( if [[ -d "$PROJECT_SHARED" ]]; then
|
||||||
git -C "$project" fetch >/dev/null 2>&1 && git -C "$project" status | grep "is behind" \
|
git -C "$PROJECT_SHARED" fetch >/dev/null 2>&1 \
|
||||||
|
&& git -C "$PROJECT_SHARED" status \
|
||||||
|
| grep "is behind" \
|
||||||
| while read status; do
|
| while read status; do
|
||||||
#log "\n\n`date` - env-shared has been improved."
|
#log "\n\n`date` - env-shared has been improved."
|
||||||
#log " '$status'"
|
#log " '$status'"
|
||||||
|
|||||||
Reference in New Issue
Block a user