rename https://git.tic.cc/open/ to /opx/
This commit is contained in:
@@ -2,7 +2,7 @@ FROM debian:12.8
|
||||
LABEL org.opencontainers.image.authors="luk"
|
||||
|
||||
RUN apt update && apt install curl -y
|
||||
RUN curl -s https://git.tic.cc/open/sysconfig/raw/branch/main/debian-setup.sh | bash
|
||||
RUN curl -s https://git.tic.cc/opx/sysconfig/raw/branch/main/debian-setup.sh | bash
|
||||
|
||||
CMD bash
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
## "curl -s https://git.tic.cc/open/sysconfig/raw/branch/main/debian-setup.sh | bash"
|
||||
## "curl -s https://git.tic.cc/opx/sysconfig/raw/branch/main/debian-setup.sh | bash"
|
||||
|
||||
echo "Usage: this.sh [NewUser]"
|
||||
echo "Example: this.sh alice"
|
||||
@@ -26,7 +26,7 @@ echo "::*** Git cloning to /faronear/sysconfig"
|
||||
git config --global credential.helper cache
|
||||
if [ ! -d "/faronear/sysconfig" ]
|
||||
then
|
||||
git clone https://git.tic.cc/open/sysconfig /faronear/sysconfig
|
||||
git clone https://git.tic.cc/opx/sysconfig /faronear/sysconfig
|
||||
chmod -R 755 /faronear # 确保其他用户能够读取 /faronear/sysconfig/nixhome/*
|
||||
fi
|
||||
echo
|
||||
|
||||
@@ -23,11 +23,11 @@ if not exist "%ROOTPATH%" (
|
||||
echo √√√ ROOTPATH = [[%ROOTPATH%]]
|
||||
)
|
||||
|
||||
echo ::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global]]
|
||||
echo ::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/.gitignore_global]]
|
||||
set /p GLOBALPATH=">>> "
|
||||
echo;
|
||||
if "" == "%GLOBALPATH%" (
|
||||
set GLOBALPATH=https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||
set GLOBALPATH=https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||
) else (
|
||||
for %P in (%GLOBALPATH%) do set "GLOBALPATH=%~dpnxP/.gitignore_global"
|
||||
if not exist "%GLOBALPATH%" (
|
||||
|
||||
@@ -26,7 +26,7 @@ else
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global]]"
|
||||
echo "::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/.gitignore_global]]"
|
||||
read -p "***:: " GLOBALPATH
|
||||
if [ "$GLOBALPATH" ]
|
||||
then
|
||||
@@ -42,7 +42,7 @@ then
|
||||
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
|
||||
fi
|
||||
else
|
||||
GLOBALPATH=https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||
GLOBALPATH=https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/.gitignore_global
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
@@ -13,6 +13,85 @@ else
|
||||
diskutil apfs create ${DISKID} $DISKNAME
|
||||
fi
|
||||
|
||||
cat <<'EOF' > /Volumes/$DISKNAME/seafile-ignore.txt
|
||||
# 特殊定制
|
||||
*.mp4
|
||||
|
||||
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
||||
*.sfignore
|
||||
*.sfignore/
|
||||
*.sfignore.*
|
||||
*.sfignore.*/
|
||||
*.sfomit
|
||||
*.sfomit.*
|
||||
*.sfomit/
|
||||
*.sfomit.*/
|
||||
*.nosf
|
||||
*.nosf.*
|
||||
*.nosf/
|
||||
*.nosf.*/
|
||||
|
||||
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||
FETCH_HEAD
|
||||
*/FETCH_HEAD
|
||||
|
||||
.Trash/
|
||||
.Trashes/
|
||||
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
*.aae # AAE 文件主要在苹果的照片应用程序中使用,保存对原始照片所做的编辑,比如,裁剪、旋转或调整亮度等操作的信息。
|
||||
|
||||
.thumbnails
|
||||
*/.thumbnails
|
||||
|
||||
Thumbs.db
|
||||
*/Thumbs.db
|
||||
thumbs.db
|
||||
*/thumbs.db
|
||||
|
||||
_desktop.ini
|
||||
*/_desktop.ini
|
||||
|
||||
._*
|
||||
*/._*
|
||||
|
||||
.$*
|
||||
*/.$*
|
||||
|
||||
~$*
|
||||
*/~$*
|
||||
|
||||
node_modules/
|
||||
*/node_modules/
|
||||
package-lock.json
|
||||
*/package-lock.json
|
||||
|
||||
pages4loader.json5
|
||||
*/pages4loader.json5
|
||||
|
||||
.deploy_git/
|
||||
*/.deploy_git/
|
||||
|
||||
# next.js 项目
|
||||
.next/
|
||||
*/.next/
|
||||
|
||||
# HBuilder 目录
|
||||
unpackage/
|
||||
*/unpackage/
|
||||
|
||||
Icon
|
||||
OneDrive/Icon
|
||||
|
||||
# wrangler project
|
||||
|
||||
.dev.vars*
|
||||
*/.dev.vars*
|
||||
.wrangler/
|
||||
*/.wrangler/
|
||||
EOF
|
||||
|
||||
# copy this script to some public folder, e.g. `sudo cp $(basename $0) /etc/`, because in my test, it doesn't work in /Users/...
|
||||
# copy the corresponding plist file to /Library/LaunchDaemons/,
|
||||
# optionally run `sudo launchctl load /Library/LaunchDaemons/my-launch-file.plist` immediately for test.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cd /Library/Application\ Support/Microsoft/MAU2.0
|
||||
|
||||
# sudo chmod 000 Microsoft\ AutoUpdate.app
|
||||
sudo mv Microsoft\ AutoUpdate.app MicrosoftAutoupdateDisabled.app
|
||||
sudo mv Microsoft\ AutoUpdate.app Microsoft\ Autoupdate.disabled.app
|
||||
@@ -53,7 +53,7 @@ if [ -d "$HomePath" ]; then
|
||||
echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
|
||||
cp -r "$NIXHOME/$homescript" ./
|
||||
elif [ "$CopyOrLinkScripts" == 'g' ]; then
|
||||
curl -sSLO "https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/$homescript"
|
||||
curl -sSLO "https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/$homescript"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -156,9 +156,9 @@ elif [ -f /etc/ubuntu_version ]; then
|
||||
MYOSVERSION=Ubt`cat /etc/ubuntu_version 2>/dev/null`
|
||||
fi
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='<\[\033[$PSTYLE;${PTYPE}2m\]\t\[\033[00m\]#\[\033[$PSTYLE;${PTYPE}5m\]\u\[\033[00m\]@\[\033[$PSTYLE;${PTYPE}1m\]\h\[\033[00m\]=\[\033[$PSTYLE;${PTYPE}4m\]$MYIPPUB\[\033[00m\]^\[\033[$PSTYLE;${PTYPE}5m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]:\[\033[$PSTYLE;${PTYPE}2m\]\w\[\033[00m\]>$IN_SSH$AS_ROOT '
|
||||
PS1='<\[\033[$PSTYLE;${PTYPE}2m\]\t\[\033[00m\]#\[\033[$PSTYLE;${PTYPE}5m\]\u\[\033[00m\]@\[\033[$PSTYLE;${PTYPE}1m\]\h\[\033[00m\]=\[\033[$PSTYLE;${PTYPE}4m\]$MYIPPUB\[\033[00m\]^\[\033[$PSTYLE;${PTYPE}5m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]:\[\033[$PSTYLE;${PTYPE}2m\]\w\[\033[00m\]>$IN_SSH$AS_ROOT\n### '
|
||||
else
|
||||
PS1='<\t#\u@\h=$MYIPPUB^$(uname -m),$(uname),$MYOSVERSION:\w>$IN_SSH$AS_ROOT ' # \w shows absolute path, \W shows current folder.
|
||||
PS1='<\t#\u@\h=$MYIPPUB^$(uname -m),$(uname),$MYOSVERSION:\w>$IN_SSH$AS_ROOT\n### ' # \w shows absolute path, \W shows current folder.
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ FETCH_HEAD
|
||||
*/FETCH_HEAD
|
||||
|
||||
.Trash/
|
||||
.Trashes/
|
||||
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
|
||||
@@ -7,8 +7,8 @@ else
|
||||
read -p "Please enter [root directory] to rename 1st level subfolders: " base_dir
|
||||
fi
|
||||
if [[ -d "$base_dir" ]]; then
|
||||
base_dir=$(realpath $base_dir)
|
||||
echo Searching in $base_dir;
|
||||
base_dir=$(realpath "$base_dir")
|
||||
echo Searching in "$base_dir";
|
||||
else
|
||||
echo not a folder!
|
||||
exit 0
|
||||
@@ -18,41 +18,43 @@ fi;
|
||||
read -p "Please enter [prod] to rename, or [anything else] to dry run: " user_input
|
||||
|
||||
# 遍历所有目录
|
||||
for dir in "$base_dir"/*/; do
|
||||
find "$base_dir" -type d | while read -r fullpath; do
|
||||
# 提取目录名称,去掉末尾的斜杠
|
||||
dir_name=$(basename "$dir")
|
||||
dir_name=$(dirname "$fullpath")
|
||||
folder_name=$(basename "$fullpath")
|
||||
|
||||
# 调试输出:检查目录名称
|
||||
echo "Processing: $dir_name"
|
||||
#echo "Processing: $folder_name"
|
||||
|
||||
# 使用正则表达式提取前缀(可选)、年份、月份和日期
|
||||
if [[ $dir_name =~ ^([^,]*),?\ ([0-9]{4})年([0-9]{1,2})月([0-9]{1,2})日$ ]]; then
|
||||
if [[ $folder_name =~ ^([^,]*),?\ ([0-9]{4})年([0-9]{1,2})月([0-9]{1,2})日$ ]]; then
|
||||
# 有前缀的情况
|
||||
prefix="${BASH_REMATCH[1]}"
|
||||
intro="${BASH_REMATCH[1]}"
|
||||
year="${BASH_REMATCH[2]}"
|
||||
month=$(printf "%02d" "${BASH_REMATCH[3]}")
|
||||
day=$(printf "%02d" "${BASH_REMATCH[4]}")
|
||||
month=$(printf "%02d\n" "$((10#${BASH_REMATCH[3]}))")
|
||||
day=$(printf "%02d\n" "$((10#${BASH_REMATCH[4]}))")
|
||||
|
||||
elif [[ $dir_name =~ ^([0-9]{4})年([0-9]{1,2})月([0-9]{1,2})日$ ]]; then
|
||||
elif [[ $folder_name =~ ^.?([0-9]{4})[年-]([0-9]{1,2})[月-]([0-9]{1,2})日?\]?_?\ ?(.*)$ ]]; then
|
||||
# 没有前缀的情况
|
||||
prefix=""
|
||||
year="${BASH_REMATCH[1]}"
|
||||
month=$(printf "%02d" "${BASH_REMATCH[2]}")
|
||||
day=$(printf "%02d" "${BASH_REMATCH[3]}")
|
||||
month=$(printf "%02d\n" "$((10#${BASH_REMATCH[2]}))")
|
||||
day=$(printf "%02d\n" "$((10#${BASH_REMATCH[3]}))")
|
||||
intro="${BASH_REMATCH[4]}"
|
||||
|
||||
else
|
||||
echo "Skipping: $dir_name (not matching expected format)"
|
||||
echo "Skip: $folder_name"
|
||||
continue
|
||||
fi
|
||||
|
||||
# 创建新的目录名称
|
||||
new_name="${year}${month}${day}"
|
||||
|
||||
if [[ -n "$prefix" ]]; then
|
||||
new_name="${new_name}_${prefix// /_}" # 替换空格为下划线
|
||||
if [[ -n "$intro" ]]; then
|
||||
new_name="${new_name}_${intro// /_}" # 替换空格为下划线
|
||||
fi
|
||||
|
||||
# 重命名目录
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$dir" "$base_dir/$new_name"; fi;
|
||||
echo "Renamed: $dir_name -> $new_name"
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$fullpath" "$dir_name/$new_name"; fi;
|
||||
echo "Renamed: $folder_name"
|
||||
echo " >>>> $dir_name/$new_name"
|
||||
done
|
||||
@@ -7,9 +7,9 @@ else
|
||||
read -p "Please enter [root directory] to rename images recursively: " target_directory
|
||||
fi
|
||||
if [[ -d "$target_directory" ]]; then
|
||||
echo Searching in $(realpath $target_directory);
|
||||
echo Searching in $(realpath "$target_directory");
|
||||
else
|
||||
echo $target_directory is not a folder!
|
||||
echo "$target_directory" is not a folder!
|
||||
exit 0
|
||||
fi;
|
||||
|
||||
@@ -18,10 +18,10 @@ read -p "Please enter [prod] to rename, or [anything else] to dry run: " user_in
|
||||
|
||||
|
||||
# 查找并遍历所有文件
|
||||
find "$target_directory" -type f | while read -r file; do
|
||||
find "$target_directory" -type f | while read -r fullpath; do
|
||||
# 获取文件的原名和扩展名
|
||||
dir_name=$(dirname "$file")
|
||||
base_name=$(basename "$file")
|
||||
dir_name=$(dirname "$fullpath")
|
||||
base_name=$(basename "$fullpath")
|
||||
extension="${base_name##*.}"
|
||||
|
||||
if [[ "$extension" = "7z" ]] || [[ "$extension" = "DS_Store" ]] || [[ "$extension" = "aae" ]] || [[ "$base_name" == *"unkn#own"* ]]; then
|
||||
@@ -35,7 +35,7 @@ find "$target_directory" -type f | while read -r file; do
|
||||
|
||||
# 如果重命名后的文件名与原文件名不同,则进行重命名
|
||||
if [[ "$base_name" != "$new_name" ]]; then
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$file" "$dir_name/$new_name"; fi;
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$fullpath" "$dir_name/$new_name"; fi;
|
||||
echo "$base_name -> $new_name"
|
||||
fi
|
||||
|
||||
@@ -45,7 +45,7 @@ find "$target_directory" -type f | while read -r file; do
|
||||
|
||||
# 获取文件的拍摄日期,假设日期以EXIF元数据存储
|
||||
# 需要安装 exiftool
|
||||
date_taken=$(exiftool -ExtractEmbedded -d "%Y%m%d#%H%M%S" -DateTimeOriginal -CreationDate -s -s -s "$file")
|
||||
date_taken=$(exiftool -ExtractEmbedded -d "%Y%m%d#%H%M%S" -DateTimeOriginal -CreationDate -s -s -s "$fullpath")
|
||||
|
||||
# 检查日期是否为空和文件名格式
|
||||
if [ -n "$date_taken" ]; then
|
||||
@@ -53,13 +53,13 @@ find "$target_directory" -type f | while read -r file; do
|
||||
new_name="${date_taken}_${base_name}"
|
||||
|
||||
# 重命名文件
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$file" "$dir_name/$new_name"; fi;
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$fullpath" "$dir_name/$new_name"; fi;
|
||||
echo "$base_name -> $new_name"
|
||||
else
|
||||
new_name="unkn#own_${base_name}"
|
||||
|
||||
# 重命名文件
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$file" "$dir_name/$new_name"; fi;
|
||||
if [[ "$user_input" == "prod" ]]; then mv "$fullpath" "$dir_name/$new_name"; fi;
|
||||
echo "$base_name -> $new_name"
|
||||
fi
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ if not exist "%ROOTPATH%" (
|
||||
echo √√√ ROOTPATH = [[%ROOTPATH%]]
|
||||
)
|
||||
|
||||
echo ::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]
|
||||
echo ::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]
|
||||
set /p IGNOREPATH=">>> "
|
||||
echo;
|
||||
if "" == "%IGNOREPATH%" (
|
||||
set IGNOREPATH=https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
||||
set IGNOREPATH=https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
||||
) else (
|
||||
for %P in (%IGNOREPATH%) do set "IGNOREPATH=%~dpnxP/seafile-ignore.global.txt"
|
||||
if not exist "%IGNOREPATH%" (
|
||||
|
||||
@@ -12,7 +12,7 @@ else
|
||||
read -p "***:: " ROOTPATH
|
||||
if [ "$ROOTPATH" ]
|
||||
then
|
||||
ROOTPATH=$(realpath $ROOTPATH)
|
||||
ROOTPATH=$(realpath "${ROOTPATH/#\~/$HOME}")
|
||||
else
|
||||
ROOTPATH=`pwd`
|
||||
fi
|
||||
@@ -26,32 +26,30 @@ else
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
|
||||
echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
|
||||
read -p "***:: " GLOBALPATH
|
||||
if [ "$GLOBALPATH" ]
|
||||
then
|
||||
GLOBALPATH=$(realpath "${GLOBALPATH/#\~/$HOME}")
|
||||
echo $GLOBALPATH
|
||||
if [ -d "$GLOBALPATH" ]
|
||||
then
|
||||
GLOBALPATH=$(realpath $GLOBALPATH)/seafile-ignore.global.txt
|
||||
GLOBALPATH="$GLOBALPATH/seafile-ignore.global.txt"
|
||||
fi
|
||||
if [ ! -f "$GLOBALPATH" ]
|
||||
if [ -f "$GLOBALPATH" ]
|
||||
then
|
||||
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
|
||||
else
|
||||
echo "××× Not found [[$GLOBALPATH]]. Exit now..."
|
||||
exit
|
||||
else
|
||||
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
|
||||
fi
|
||||
else
|
||||
GLOBALPATH=https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
||||
GLOBALPATH=https://git.tic.cc/opx/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "::*** Enter [y] to start updating, or [anything else] to quit"
|
||||
echo "::*** Enter [y] to start updating, or [anything else] for dry-run"
|
||||
read -p "***:: " YESNO
|
||||
if [ "$YESNO" != 'y' ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
cd $ROOTPATH
|
||||
echo "*** Starting from [[`pwd`]] ***"
|
||||
@@ -62,13 +60,19 @@ do
|
||||
if [ -f "$repo/seafile-ignore.txt" ] || [ -d "$repo/.git" ]
|
||||
then
|
||||
echo "---- updating [[$repo/seafile-ignore.txt]] ----"
|
||||
if [ "$YESNO" = 'y' ]
|
||||
then
|
||||
if [ -f "$GLOBALPATH" ]
|
||||
then
|
||||
cat $GLOBALPATH > $repo/seafile-ignore.txt
|
||||
else
|
||||
curl -sSL $GLOBALPATH | cat > $repo/seafile-ignore.txt
|
||||
fi
|
||||
if [ -f "$repo/seafile-ignore.local.txt" ]
|
||||
then
|
||||
cat $repo/seafile-ignore.local.txt 2>/dev/null >> $repo/seafile-ignore.txt
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo ::*** Merge remote [seafile-ignore.global.txt] and local [seafile-ignore.local.txt] to [seafile-ignore.txt]
|
||||
curl -sSL https://git.tic.cc/open/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt > seafile-ignore.txt
|
||||
if [ -f seafile-ignore.local.txt ]; then cat seafile-ignore.local.txt >> seafile-ignore.txt; fi
|
||||
echo
|
||||
@@ -27,9 +27,11 @@ FETCH_HEAD
|
||||
*/FETCH_HEAD
|
||||
|
||||
.Trash/
|
||||
.Trashes/
|
||||
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
*.aae # AAE 文件主要在苹果的照片应用程序中使用,保存对原始照片所做的编辑,比如,裁剪、旋转或调整亮度等操作的信息。
|
||||
|
||||
.thumbnails
|
||||
*/.thumbnails
|
||||
|
||||
Reference in New Issue
Block a user