- ajout du git init
This commit is contained in:
parent
0d4925e870
commit
5895846530
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
CONFIG_SERVER_GIT="https://gitea.server.home/"
|
||||
28
func/git.sh
28
func/git.sh
|
|
@ -1,3 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "${WELCOME_SCRIPT_PATH}" ]]; then
|
||||
WELCOME_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)"
|
||||
fi
|
||||
|
||||
#region INCLUDES
|
||||
. "${WELCOME_SCRIPT_PATH}/config/config_git.sh"
|
||||
#endregion
|
||||
|
||||
getbranch(){
|
||||
local branch
|
||||
|
||||
|
|
@ -8,7 +18,16 @@ getbranch(){
|
|||
exit
|
||||
fi
|
||||
|
||||
echo $branch
|
||||
echo "$branch"
|
||||
}
|
||||
|
||||
gitinit(){
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git branch -M main
|
||||
git remote add origin "${1:-$CONFIG_SERVER_GIT}"
|
||||
git push -u origin main
|
||||
}
|
||||
|
||||
gitreset(){
|
||||
|
|
@ -67,8 +86,7 @@ script_update() {
|
|||
|
||||
cd "$WELCOME_SCRIPT_PATH" || return 2
|
||||
|
||||
git fetch origin >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
if ! git fetch origin >/dev/null 2>&1; then
|
||||
msg_error "Erreur lors du Fetch"
|
||||
cd "$current_path" || :
|
||||
return 3
|
||||
|
|
@ -85,8 +103,8 @@ script_update() {
|
|||
|
||||
# update
|
||||
echo ""
|
||||
git reset --hard origin/"$BRANCH"
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
if git reset --hard origin/"$BRANCH"; then
|
||||
msg_success "Les script de welcome a été mis à jour !! relancer le ssh pour profiter des nouvelles fonctionnalités"
|
||||
echo ""
|
||||
cd "$current_path" || :
|
||||
|
|
|
|||
|
|
@ -54,8 +54,11 @@ alias wlog='tail -fn 100 /var/log/apache2/access.log /var/log/apache2/error.log'
|
|||
if [[ -z "${WELCOME_SCRIPT_PATH}" ]]; then
|
||||
WELCOME_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)"
|
||||
fi
|
||||
. "${WELCOME_SCRIPT_PATH}/config/config_git.sh"
|
||||
. "${WELCOME_SCRIPT_PATH}/func/git.sh"
|
||||
|
||||
# init repo
|
||||
alias gitinit='gitinit'
|
||||
# get last changes
|
||||
alias gitsync='gitsync'
|
||||
# restore as depot
|
||||
|
|
|
|||
Loading…
Reference in New Issue