mirror of
https://github.com/sbopkg/sbopkg
synced 2025-02-07 08:46:04 +01:00
Add update ability for -current repo
This commit is contained in:
parent
3297b4aa1d
commit
8efdf1a6dd
1 changed files with 21 additions and 0 deletions
|
@ -2432,6 +2432,23 @@ rsync_command() {
|
|||
rm -f $SYNC_LOCK
|
||||
}
|
||||
|
||||
current_check_updates() {
|
||||
# This function checks for updates if repository is set to -current.
|
||||
|
||||
local URL BRANCH REMOTE LOCAL
|
||||
|
||||
eval $(sed 's/^\(.*\)@\(.*\)$/URL=\1; BRANCH=\2/g' <<< $REPO_LINK)
|
||||
|
||||
cd $REPO_DIR
|
||||
REMOTE=$(git ls-remote $URL $BRANCH | cut -f 1)
|
||||
LOCAL=$(git rev-parse HEAD)
|
||||
# If the remote has changed, wipe the local version
|
||||
if [[ $REMOTE != $LOCAL ]]; then
|
||||
cd ..
|
||||
rm -fR $REPO_DIR
|
||||
fi
|
||||
}
|
||||
|
||||
git_command() {
|
||||
# This function synchronizes a local git repository with upstream.
|
||||
|
||||
|
@ -2441,6 +2458,10 @@ git_command() {
|
|||
eval $(sed 's/^\(.*\)@\(.*\)$/URL=\1; BRANCH=\2/g' <<< $REPO_LINK)
|
||||
|
||||
CWD=$(pwd)
|
||||
# If -CURRENT, handle correctly
|
||||
if [[ $REPO_BRANCH == "current" ]]; then
|
||||
current_check_updates
|
||||
fi
|
||||
# Create the repository if needed
|
||||
if [[ ! -d $REPO_DIR/.git ]]; then
|
||||
mkdir -p $REPO_DIR
|
||||
|
|
Loading…
Add table
Reference in a new issue