]> Git [git.vados.ru] :: Repos - Mikrotiks/Mikrotiks.git/commitdiff
Autocommit in repo: Mikrotiks, generated by owner: root, in 04:53:47 12.03.2026.
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Thu, 12 Mar 2026 01:53:47 +0000 (04:53 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Thu, 12 Mar 2026 01:53:47 +0000 (04:53 +0300)
22 files changed:
.bin/Makefile [deleted file]
.bin/commitinfo.sh [deleted file]
.gitignore
Makefile
bin/bash-progress-indicator/LICENSE [moved from .bin/bash-progress-indicator/LICENSE with 100% similarity]
bin/bash-progress-indicator/README.md [moved from .bin/bash-progress-indicator/README.md with 100% similarity]
bin/bash-progress-indicator/main.sh [moved from .bin/bash-progress-indicator/main.sh with 100% similarity]
bin/bash-progress-indicator/progress.sh [moved from .bin/bash-progress-indicator/progress.sh with 100% similarity]
bin/bash-progress-indicator/progress_advanced.sh [moved from .bin/bash-progress-indicator/progress_advanced.sh with 100% similarity]
bin/bash-progress-indicator/spinner.sh [moved from .bin/bash-progress-indicator/spinner.sh with 100% similarity]
bin/check_repo.sh [new file with mode: 0755]
bin/logs [moved from .bin/logs with 100% similarity]
bin/ros-conf/.ssh/known_hosts [moved from .bin/ros-conf/.ssh/known_hosts with 100% similarity]
bin/ros-conf/.ssh/mikro_bak_rsa [moved from .bin/ros-conf/.ssh/mikro_bak_rsa with 100% similarity]
bin/ros-conf/.ssh/mikro_bak_rsa.pub [moved from .bin/ros-conf/.ssh/mikro_bak_rsa.pub with 100% similarity]
bin/ros-conf/README.md [moved from .bin/ros-conf/README.md with 100% similarity]
bin/ros-conf/setup-ssh-keys.sh [moved from .bin/ros-conf/setup-ssh-keys.sh with 100% similarity]
bin/ros-conf/sync-script.sh [moved from .bin/ros-conf/sync-script.sh with 100% similarity]
bin/ros-diff.sh [moved from .bin/ros-diff.sh with 100% similarity]
bin/scripts/mktmpfs.rsc [moved from .bin/scripts/mktmpfs.rsc with 100% similarity]
bin/test.sh [moved from .bin/test.sh with 100% similarity]
log.txt [deleted file]

diff --git a/.bin/Makefile b/.bin/Makefile
deleted file mode 100644 (file)
index 71488ed..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile
-
-
-all: checout add
-#commit push cleam
-
-checout: git checkout HEAD -- $(Mikrotiks)
-
-#add:
\ No newline at end of file
diff --git a/.bin/commitinfo.sh b/.bin/commitinfo.sh
deleted file mode 100755 (executable)
index 7c0a6a7..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-currDir=`pwd`
-
-git add .
-
-if git commit -m "Backup for ${currDir} sucessfully creatd at $(date '+%b %d %T')."; then
-
-    if git push origin main; then
-#        save_log "${log_msg}"
-       exit 0
-    else
-#        save_log "${log_msg}"
-       exit 1
-    fi
-
-else
-
-exit 1
-fi
-
-#sed \
-#      -e "/^:global CommitId/c :global CommitId \"${COMMITID:-unknown}\";" \
-#      -e "/^:global CommitInfo/c :global CommitInfo \"${COMMITINFO:-unknown}\";" \
-#      < "${1}"
index 1cb6ecbc73ddec3c6012baf089a868dba52d7f6d..5832e5bb55abae16c986fb0f001bcb09a77c6a0c 100644 (file)
@@ -1,5 +1,10 @@
 # folder for backups repo
 backups
+.bin/logs
+.gnupg
+.local
+.cache
+.bash_history
 #.bak
 # backup and temporary files
 *~
index 30cfdb2decb62ab64ecb1fff5cbd68477adf2909..862389ad90716902004138bf96fd1f4aa955e9c3 100644 (file)
--- a/Makefile
+++ b/Makefile
+# Makefile
 
-GITCMDS                := fetch checkout pull add commit push
-DATE           ?= $(shell (date '+%T %d.%m.%Y'))
-DTSTAMP                ?= $(shell (date '+%Y%d%m%H%M%S'))
-VERSION                ?= $(shell git symbolic-ref --short HEAD 2>/dev/null)/$(shell git rev-list --count HEAD 2>/dev/null)/$(shell git rev-parse --short=8 HEAD 2>/dev/null)
-OWNER          ?= $(shell whoami)
-CHECK          ?= $(shell cat "./gitVer.txt")
+BUILD_DIR       = $(shell pwd)
+REPO_DIR        ?= $(BUILD_DIR)
 
-#export DATE DTSTAMP VERSION
+ALL_RSC         := $(wildcard html/*.rsc html/*/*.rsc)
+commitinfo.sh   := $(wildcard bin/commitinfo.sh)
+GLOB_RSC        := $(wildcard html/AM-GlobalFunc.rsc)
 
-all: $(GITCMDS)
+SHELL := /bin/bash
 
+include ../.config/config.mk
 
-.PHONY: $(GITCMDS)
+COMM_TAG := $(shell git rev-list --abbrev-commit --tags --max-count=1)
+# `2>/dev/null` suppress errors and `|| true` suppress the error codes.
+TAG := $(shell git describe --abbrev=0 --tags ${COMM_TAG} 2>/dev/null || true)
+# here we strip the version prefix
+TAG_VERS :=$(TAG:v%=%)
+# get the latest commit hash in the short form
+COMM_HASH := $(shell git rev-parse --short=8 HEAD 2>/dev/null) # Get short commit hash
+#COMMIT := $(shell git rev-parse --short HEAD)
+# get the latest commit date in the form of YYYYmmddHHMM ($(DTSTAMP_FMT))
+COMM_DATE := $(shell git log -1 --format=%cd --date=format:$(DTSTAMP_FMT))
+ifneq ($(COMM_HASH), $(COMM_TAG))
+    TAG_VERS :=$(TAG_VERS)-next-$(COMM_HASH)-$(COMM_DATE)
+endif
+ifeq ($(TAG_VERS), )
+    TAG_VERS :=$(COMM_HASH)-$(COMM_DATE)
+endif
+ifneq ($(shell git status --porcelain), )
+    TAG_VERS :=$(TAG_VERS)-dirty
+endif
 
-fetch: ORIGIN  := main
-commit: ARGS   := -m
-commit:        SRING   := "$(DATE) - Commit version: $(VERSION), owner $(OWNER)."
+.ONESHELL:
 
-#define edit-file = 
-#    cd $@ && \
-#    wget -r -nH -X $(EXCLUDEDIRS) --restrict-file-names=nocontrol $(DOMAIN)
-#endef
+export BUILD_DIR REPO_DIR ALL_RSC GLOB_RSC
 
-$(GITCMDS):
-    
-commitinfo: AM-global-functions.rsc
-       contrib/commitinfo.sh $< > $<~
+.DEFAULT_GOAL := all
+
+.PHONY: all check commit notify test
+
+all:
+       @$(MAKE) check; rc=$$?; \
+       if [ $$rc -eq 0 ]; then \
+               echo "[add] check $$rc, go to commit..."; \
+               $(MAKE) commit; cm=$$?; \
+               if [ $$cm -eq 0 ]; then \
+                       echo "[all] commit exit $$ci. Exit Ok."; \
+               else \
+                       $(MAKE) notify MSG="[all] commit exit $$ci. Check it!"; \
+               fi \
+       else \
+               echo "[all] check exit $$rc, repo is clean exit Ok."; \
+       fi
+       @echo "[all] done"
+
+run:
+       @$(MAKE) check; rc=$$?; \
+       if [ $$rc -eq 0 ]; then \
+               echo "[run] check $$rc, go to commitinfo.sh..."; \
+               $(MAKE) $(commitinfo.sh); ci=$$?; \
+               if [ $$ci -eq 0 ]; then \
+                       echo "[run] commitinfo.sh exit $$ci. Go to checksums.sh..."; \
+                       $(MAKE) checksums; cs=$$?; \
+                       if [ $$cs -eq 0 ]; then \
+                               echo "[run] checksums.sh exit $$cs. Do git add commit and push..."; \
+                               git add .; \
+                               git commit -m '$(COMM_INFO)'; \
+                               git push; \
+                       else \
+                               $(MAKE) notify MSG="[run] checksums.sh exit $$cs, check it!"; \
+                       fi \
+                       else \
+                               $(MAKE) notify MSG="[run] commitinfo.sh exit $$ci, check it!"; \
+                       fi \
+       else \
+               echo "[run] check exit $$rc, repo is clean exit Ok."; \
+       fi
+       @echo "[run] done"
+
+check:
+       @bash bin/check_repo.sh
+
+commit:
+       cd $(BUILD_DIR)
+       git add .
+       git commit -m '$(COMM_INFO)'
+       git push
+
+notify:
+       @bash bin/notify_telegram.sh "$(MSG)"
+
+checksums: checksums.json
+
+checksums.json: bin/checksums.sh $(ALL_RSC)
+       bin/checksums.sh > html/tmp/$@
+
+$(commitinfo.sh): $(GLOB_RSC)
+       $(commitinfo.sh) $< > $<~
        mv $<~ $<
 
-clean:
-       rm -f $(HTML) checksums.json
-       make -C contrib/ clean
+test:
+       @bash -n bin/check_repo.sh
+       @bash -n bin/notify_telegram.sh
+       @bash -n bin/checksums.sh
+       @bash -n bin/commitinfo.sh
+       @echo "syntax ok"
+
+#clean:
+#              git checkout HEAD -- .
diff --git a/bin/check_repo.sh b/bin/check_repo.sh
new file mode 100755 (executable)
index 0000000..1ecb927
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+cd "${REPO_DIR:-.}"
+
+dirty="$(git ls-files -u || true)"
+lsfiles="$(git ls-files --others --exclude-standard || true)"
+
+# Conflict or unresolved state: stop and notify.
+if [[ -n "$dirty" ]]; then
+    echo "[check_repo] repo has conflicts, stop"
+    echo "[check_repo] unmerged files:"
+    printf "%s\n" "$dirty"
+    echo "[check_repo] resolve conflicts and run: git add <files> && git commit"
+    bash bin/notify_telegram.sh "STOP: repo conflicts in $(pwd)"
+    exit 1
+fi
+
+# Exit 0 only when repo is NOT clean to allow autocommit flow.
+if git diff --quiet && git diff --cached --quiet && [[ -z "$lsfiles" ]]; then
+    echo "[check_repo] repo clean. Exit 1 from check_repo.sh."
+    exit 1
+else
+    echo "[check_repo] repo not clean. Exit 0 from check_repo.sh."
+    exit 0
+fi
similarity index 100%
rename from .bin/logs
rename to bin/logs
similarity index 100%
rename from .bin/ros-diff.sh
rename to bin/ros-diff.sh
similarity index 100%
rename from .bin/test.sh
rename to bin/test.sh
diff --git a/log.txt b/log.txt
deleted file mode 100644 (file)
index 76553c5..0000000
--- a/log.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-1 = global-functions.rsc COMMITINFO:-unknown = unknown COMMITID:-unknown = unknown
-VERSION = main/3423/a3c815c2 DATE = Mar 03 16:35:41
-1 = global-functions.rsc COMMITINFO:-unknown = unknown COMMITID:-unknown = unknown
-VERSION = main/3423/a3c815c2 DATE = Mar 03 16:35:59
-1 = global-functions.rsc COMMITINFO:-unknown = unknown COMMITID:-unknown = unknown
-VERSION = main/3423/a3c815c2 DATE = 16:38:10 03.03.2026
-1 = global-functions.rsc COMMITINFO:-unknown = unknown COMMITID:-unknown = unknown
-VERSION = main/3423/a3c815c2 DATE = 17:38:05 03.03.2026