change "echo ===" to "echo #<<<" to avoid confusing when searching for ===

This commit is contained in:
Luk 2024-12-13 20:09:17 +08:00
parent 4f1b5809e0
commit c063e02f1e
58 changed files with 328 additions and 265 deletions

View File

@ -1,21 +1,21 @@
while [ ! "$TARGET_HOSTNAME" ]
do
echo "=== DNS name such as www.example.com: "
read -p ">>> " TARGET_HOSTNAME
echo "#<<< DNS name such as www.example.com: "
read -p "#>>> " TARGET_HOSTNAME
done
echo "*** -d $TARGET_HOSTNAME"
echo
while [ ! "$ISSUEMODE" ]
do
echo "=== Issue mode:"
echo "#<<< Issue mode:"
echo " [s] for standalone"
echo " [w] for webroot"
echo " [n] for nginx"
echo " [a] for apache"
echo " [c] for challenge-alias"
echo " [d] for dnsapi"
read -p ">>> " ISSUEMODE
read -p "#>>> " ISSUEMODE
if [ "$ISSUEMODE" == 's' ]
then
ISSUEPARM="--standalone"
@ -45,8 +45,8 @@ if [ "$ISSUEMODE" == 'd' ]
then
while [ ! "$DNSAPI" ]
do
echo "=== DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:"
read -p ">>> " DNSAPI_PROVIDER
echo "#<<< DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:"
read -p "#>>> " DNSAPI_PROVIDER
if [ "$DNSAPI_PROVIDER" == 'cf' ]
then
DNSAPI='dns_cf'
@ -70,25 +70,25 @@ echo "***"
~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI
echo
echo "=== Install certificates? [n] for no, [anything else] to install: "
read -p ">>> " INSTALL_CERT
echo "#<<< Install certificates? [n] for no, [anything else] to install: "
read -p "#>>> " INSTALL_CERT
if [ "$INSTALL_CERT" != 'n' ]
then
echo
while [ ! "$KEY_FILE_PATH" ]
do
echo "=== Deploy key file to: "
read -p ">>> " KEY_FILE_PATH
echo "#<<< Deploy key file to: "
read -p "#>>> " KEY_FILE_PATH
done
echo
while [ ! "$FULLCHAIN_FILE_PATH" ]
do
echo "=== Deploy fullchain file to: "
read -p ">>> " FULLCHAIN_FILE_PATH
echo "#<<< Deploy fullchain file to: "
read -p "#>>> " FULLCHAIN_FILE_PATH
done
echo
echo "=== Set reload command, [leave blank] for default to 'service nginx force-reload'"
read -p ">>> " RELOADCMD
echo "#<<< Set reload command, [leave blank] for default to 'service nginx force-reload'"
read -p "#>>> " RELOADCMD
if [ ! "$RELOADCMD" ]
then
RELOADCMD="service nginx force-reload"

View File

@ -1,13 +1,13 @@
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
# __conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
# __conda_setup="$('/usr/local/Caskroom/miniconda/base/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
# if [ $? -eq 0 ]; then
# eval "$__conda_setup"
# else
# if [ -f "$(brew --repo)/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
# . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
# if [ -f "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
# . "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh"
# else
# export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
# export PATH="/usr/local/Caskroom/miniconda/base/bin:$PATH"
# fi
# fi
# unset __conda_setup
@ -15,5 +15,12 @@
echo "Please run this script with 'source', otherwise it won't take effect in the current shell."
source "$(brew --repo)/Caskroom/miniconda/base/etc/profile.d/conda.sh"
if [ -f "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]
then
source "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh"
elif [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]
then
source "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
fi
conda activate base

2
conda-install.sh Normal file
View File

@ -0,0 +1,2 @@
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash
echo "=== Enter Pi precision to calculate (leave blank for default to 5000): "
read -p ">>> " precision
echo "#<<< Enter Pi precision to calculate (leave blank for default to 5000): "
read -p "#>>> " precision
if [ ! $precision ]; then
precision=5000
fi

View File

@ -5,8 +5,8 @@ echo
NewUser=$1
while [ ! "$NewUser" ]
do
echo "=== To add a new user of name:"
read -p ">>> " NewUser
echo "#<<< To add a new user of name:"
read -p "#>>> " NewUser
done
useradd $NewUser
@ -22,8 +22,8 @@ sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd
# Debian 9 default to empty
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd
echo "=== Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p ">>> " AllowSudo
echo "#<<< Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p "#>>> " AllowSudo
if [ "$AllowSudo" = "y" ]
then
#usermod -a -G sudo $NewUser # Add to sudo group # Option 1: add user to %sudo group

View File

@ -3,8 +3,8 @@
echo "Thanks https://github.com/bohanyang/debi"
echo
echo "=== Enter debian version [8,9,10,11] or [leave blank] for 11"
read -p ">>> " DEBIAN_VERSION
echo "#<<< Enter debian version [8,9,10,11] or [leave blank] for 11"
read -p "#>>> " DEBIAN_VERSION
if [ -z "${DEBIAN_VERSION}" ]
then
DEBIAN_VERSION=11
@ -23,8 +23,8 @@ ARCH=`dpkg --print-architecture`
# ARCH=amd64
# fi
echo "=== Enter presets to download from [cdn, aws, china] or [leave blank] for cdn"
read -p ">>> " PRESET
echo "#<<< Enter presets to download from [cdn, aws, china] or [leave blank] for cdn"
read -p "#>>> " PRESET
if [ -z "${PRESET}" ]
then
PRESET=cdn
@ -35,11 +35,11 @@ sudo chmod a+rx debi.sh
sudo ./debi.sh --version $DEBIAN_VERSION --architecture `dpkg --print-architecture` --user root --$PRESET # --architecture 可参略或者[amd64默认, i386, arm64, armhf]--password 可省略,则脚本启动后会问你要密码
echo
echo "=== Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes"
read -p ">>> " LAST
echo "#<<< Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes"
read -p "#>>> " LAST
if [ 'r' = "$LAST" ]
then
echo "=== Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh"
echo "#<<< Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh"
sudo shutdown -r now
else
sudo rm -rf debi.sh /etc/default/grub.d/zz-debi.cfg /boot/debian-* && { sudo update-grub || sudo grub2-mkconfig -o /boot/grub2/grub.cfg; }

View File

@ -2,7 +2,7 @@ FROM debian:11.5
LABEL org.opencontainers.image.authors="luk"
RUN apt update && apt install curl -y
RUN curl https://git.faronear.org/npm/sysconfig/raw/branch/main/debian-setup.sh > ~/debian-setup.sh && echo -e "l\n\n\n\n\n" | bash ~/debian-setup.sh
RUN curl https://git.tic.cc/npm/sysconfig/raw/branch/main/debian-setup.sh > ~/debian-setup.sh && echo -e "l\n\n\n\n\n" | bash ~/debian-setup.sh
CMD bash

View File

@ -11,17 +11,17 @@ else
NewUser=adot
fi
echo "=== Installing basic tools"
echo "#<<< Installing basic tools"
apt update
apt install -y emacs git wget curl screen sudo automake rsync net-tools dnsutils gcc g++ make python3 jq
# Debian 12.0 has no python package, However the following packages replace it: python-is-python3 2to3
echo
echo "=== Making dir /faronear/"
echo "#<<< Making dir /faronear/"
mkdir -p /faronear/
echo
echo "=== Git cloning to /faronear/sysconfig"
echo "#<<< Git cloning to /faronear/sysconfig"
git config --global credential.helper cache
if [ ! -d "/faronear/sysconfig" ]
then
@ -30,19 +30,19 @@ then
fi
echo
echo "=== Configure root home"
echo "#<<< Configure root home"
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root
echo
echo "=== Change root password? [y] for yes, [anything else] for omit:"
read -p ">>> " ChangeRootPassword
echo "#<<< Change root password? [y] for yes, [anything else] for omit:"
read -p "#>>> " ChangeRootPassword
if [ "$ChangeRootPassword" == 'y' ]
then
passwd
fi
echo
echo "=== Configure /etc/sudoers to includedir /etc/sudoers.d"
echo "#<<< Configure /etc/sudoers to includedir /etc/sudoers.d"
#sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers # allow all users in %sudo group to sudo without password
DebianVersionMain=`cat /etc/debian_version | sed -r 's/^([0-9]+)\..*$/\1/'`
if [ "$DebianVersionMain" == '10' ]
@ -58,16 +58,16 @@ echo
if [ -e /etc/ssh/sshd_config ]
then
echo "=== Deny root login: PermitRootLogin no"
echo "#<<< Deny root login: PermitRootLogin no"
sed -i "s|PermitRootLogin |#PermitRootLogin |g" /etc/ssh/sshd_config && echo 'PermitRootLogin no' >> /etc/ssh/sshd_config
echo "=== Allow password login: PasswordAuthentication yes"
echo "#<<< Allow password login: PasswordAuthentication yes"
sed -i "s|PasswordAuthentication |#PasswordAuthentication |g" /etc/ssh/sshd_config && echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
service sshd restart
echo
fi
echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname
echo "#<<< Set [new hostname] or [leave blank] for no change"
read -p "#>>> " NewHostname
if [ $NewHostname ]
then
sed -i "s|\b`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts
@ -77,7 +77,7 @@ else
fi
echo
echo "=== Configure autostart"
echo "#<<< Configure autostart"
if [ -f /etc/rc.local ]
then
# 在腾讯云的 Debian 11.1 里,/etc/rc.local 第一行是 "#!bin/bash",应当是错误的。
@ -93,24 +93,24 @@ chmod +x /faronear/autostart.sh
echo 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.'
echo
echo "=== Configure locales: [y] for yes, [anything else] for no change:"
read -p ">>> " ConfigLocales
echo "#<<< Configure locales: [y] for yes, [anything else] for no change:"
read -p "#>>> " ConfigLocales
if [ "$ConfigLocales" == 'y' ]
then
dpkg-reconfigure locales
fi
echo
echo "=== Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:"
read -p ">>> " AddNewUser
echo "#<<< Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:"
read -p "#>>> " AddNewUser
if [ "$AddNewUser" == 'y' ]
then
source /faronear/sysconfig/debian-add-user.sh $NewUser
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser
echo
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:"
read -p ">>> " XfceAutologin
echo "#<<< Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:"
read -p "#>>> " XfceAutologin
if [ "$XfceAutologin" == "y" ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
@ -122,4 +122,4 @@ then
fi
echo
echo "=== Debian System Setup Completed."
echo "#<<< Debian System Setup Completed."

View File

@ -1,30 +1,30 @@
#!/bin/bash
echo ">>> cat /etc/issue"
echo "#>>> cat /etc/issue"
cat /etc/issue
echo
echo ">>> cat /etc/debian_version"
echo "#>>> cat /etc/debian_version"
cat /etc/debian_version
echo
echo ">>> cat /etc/os-release"
echo "#>>> cat /etc/os-release"
cat /etc/os-release
echo
echo ">>> cat /etc/cpuinfo"
echo "#>>> cat /etc/cpuinfo"
cat /etc/cpuinfo
echo
# echo ">>> lsb-release"
# echo "#>>> lsb-release"
# apt install lsb-release
# lsb-release -a
# echo
echo ">>> hostnamectl"
echo "#>>> hostnamectl"
hostnamectl
echo
echo ">>> uname -a"
echo "#>>> uname -a"
uname -a
echo

View File

@ -1,10 +1,10 @@
echo "=== Add a non-root user to run docker"
echo "#<<< Add a non-root user to run docker"
if [ "$1" ]
then
DOCKERUSER=$1
else
echo "Enter the [user name] or [leave blank] for default to '`whoami`'"
read -p ">>> " DOCKERUSER
read -p "#>>> " DOCKERUSER
if [ ! "$DOCKERUSER" ]
then
DOCKERUSER=`whoami`

13
docker-install.sh → docker-install-debian.sh Executable file → Normal file
View File

@ -6,8 +6,9 @@
# 安装自带版本 apt install docker.io && apt install docker-compose
# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
echo "=== Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default"
read -p ">>> " DOCKER_SOURCE
echo "#<<< Option 1: Install docker with latest official repositories, Option 2: Install docker with default (maybe outdated) linux repositories (sudo apt install docker.io && sudo apt install docker-compose && sudo snap install docker)"
echo "#<<< Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default"
read -p "#>>> " DOCKER_SOURCE
if [ "$DOCKER_SOURCE" = 'a' ]
then
GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg
@ -48,8 +49,8 @@ docker compose version
# sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# sudo chmod +x /usr/local/bin/docker-compose
echo "=== Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:"
read -p ">>> " DOCKER_MIRROR
echo "#<<< Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:"
read -p "#>>> " DOCKER_MIRROR
if [ "$DOCKER_MIRROR" = 'y' ]
then
echo '{ "registry-mirrors": [' > /etc/docker/daemon.json
@ -61,8 +62,8 @@ then
echo '] }' >> /etc/docker/daemon.json
fi
echo "=== 启动docker服务[y] for yes, [anything else] for no"
read -p ">>> " StartDockerDaemon
echo "#<<< 启动docker服务[y] for yes, [anything else] for no"
read -p "#>>> " StartDockerDaemon
if [ "$StartDockerDaemon" = 'y' ]
then
sudo systemctl enable docker # 开机启动

16
docker-install-ubuntu.sh Normal file
View File

@ -0,0 +1,16 @@
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo docker --version

View File

@ -9,8 +9,8 @@ echo
IMAGE=$1
while [ ! "$IMAGE" ]
do
echo "=== Enter [image name]:"
read -p ">>> " IMAGE
echo "#<<< Enter [image name]:"
read -p "#>>> " IMAGE
echo
done
@ -21,8 +21,8 @@ then
then
OWNER="library"
else
echo "=== Enter [owner name] or [empty] for default 'library':"
read -p ">>> " OWNER
echo "#<<< Enter [owner name] or [empty] for default 'library':"
read -p "#>>> " OWNER
if [ ! "$OWNER" ]
then
OWNER="library"
@ -31,7 +31,7 @@ then
fi
echo
echo "=== Searching $OWNER/$IMAGE ......"
echo "#<<< Searching $OWNER/$IMAGE ......"
echo
page_size=100

View File

@ -23,8 +23,8 @@ else
echo " sh : $sh"
echo " wx : $wx"
echo
echo "=== Enter target (leave blank to specify host/user/pwd):"
read -p ">>> " TARGET
echo "#<<< Enter target (leave blank to specify host/user/pwd):"
read -p "#>>> " TARGET
if [ ! $TARGET ]
then
TARGET=other
@ -59,5 +59,5 @@ else
read -p "root password = " ROOT_SU
done
expect ~/faronear/npm/sysconfig/expect-ssh.sh $HOST $USER $PWD_USER $PWD_SU
expect ~/sysconfig/expect-ssh.sh $HOST $USER $PWD_USER $PWD_SU
fi

View File

@ -3,39 +3,39 @@ echo "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name
echo "***************************************"
echo "To find in which path? Enter [root path] or [leave blank] for the current path [[`pwd`]]:"
read -p ">>> " FIND_FOLDER
read -p "path #>>> " FIND_FOLDER
if [ ! "$FIND_FOLDER" ]
then
FIND_FOLDER=`pwd`
fi
read -p "mindepth >>> " MINDEPTH
read -p "mindepth #>>> " MINDEPTH
if [ "$MINDEPTH" ]
then
MINDEPTH_CLAUSE="-mindepth $MINDEPTH"
fi
read -p "maxdepth >>> " MAXDEPTH
read -p "maxdepth #>>> " MAXDEPTH
if [ "$MAXDEPTH" ]
then
MAXDEPTH_CLAUSE="-maxdepth $MAXDEPTH"
fi
echo "To find file or directory? [f] for file, [d] for directory, [l] for link, [anything else] for all:"
read -p ">>> " FIND_TYPE
read -p "type #>>> " FIND_TYPE
if [ "$FIND_TYPE" = 'f' ] || [ "$FIND_TYPE" = 'd' ] || [ "$FIND_TYPE" = 'l' ]
then
FIND_TYPE_CLAUSE="-type $FIND_TYPE"
fi
echo "To match pattern: [regex pattern] (e.g. '._*', '.*.js') or or [leave blank] for all:"
read -p ">>> " FIND_PATTERN
read -p "#>>> " FIND_PATTERN
if [ ! "$FIND_PATTERN" ]
then
FIND_PATTERN="*"
fi
echo "To do something on each: [command line] or [leave blank] for 'echo':"
read -p ">>> " FIND_ACTION
read -p "pattern #>>> " FIND_ACTION
if [ ! "$FIND_ACTION" ]
then
FIND_ACTION='echo'

View File

@ -4,8 +4,8 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Install geth version of \n [version number] for example 1.10.26 \n [leave blank] for the latest version"
read -p ">>> " VERSION
echo "#<<< Install geth version of \n [version number] for example 1.10.26 \n [leave blank] for the latest version"
read -p "#>>> " VERSION
fi
if [ "$(uname)" = "Linux" ]
@ -27,8 +27,8 @@ fi
OS=`uname | tr 'A-Z' 'a-z'`
echo "=== Install geth[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change"
read -p ">>> " BINARY_OR_SOURCE
echo "#<<< Install geth[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change"
read -p "#>>> " BINARY_OR_SOURCE
if [ "$BINARY_OR_SOURCE" == 'b' ]
then
echo "--- Extracting download link with correct hash from https://geth.ethereum.org/downloads"

View File

@ -1,16 +1,16 @@
#!/bin/bash
echo "=== Set [datadir] name, leave [blank] for default 'pex-data-poa'(可以尚未存在):"
read -p ">>> " DATADIR
echo "#<<< Set [datadir] name, leave [blank] for default 'pex-data-poa'(可以尚未存在):"
read -p "#>>> " DATADIR
if [ ! "$DATADIR" ]
then
DATADIR=chain-poa
fi
echo "*** DATADIR === $DATADIR "
echo "*** DATADIR = $DATADIR "
echo ""
echo "=== Init accounts: [y] for yes, [anything else] for no change"
read -p ">>> " INIT_ACCOUNTS
echo "#<<< Init accounts: [y] for yes, [anything else] for no change"
read -p "#>>> " INIT_ACCOUNTS
if [ $INIT_ACCOUNTS ] && [ $INIT_ACCOUNTS == 'y' ]
then
echo "--- 生成新账户,自动存放在 ./$DATADIR/keystore/"
@ -24,8 +24,8 @@ else
fi
echo ""
echo "=== Init chain from genesis-$DATADIR.json: [y] for yes, [anything else] for no change"
read -p ">>> " INIT_CHAIN
echo "#<<< Init chain from genesis-$DATADIR.json: [y] for yes, [anything else] for no change"
read -p "#>>> " INIT_CHAIN
if [ $INIT_CHAIN ] && [ $INIT_CHAIN == 'y' ]
then
echo "--- 初始化链上数据,存放在 ./$DATADIR/geth/"

View File

@ -4,8 +4,8 @@ DATADIR=$1
while [ ! "$DATADIR" ] || [ ! -d "./$DATADIR" ]
do
echo "=== Set [datadir] name, leave [blank] for default 'pex-data-poa'"
read -p ">>> " DATADIR
echo "#<<< Set [datadir] name, leave [blank] for default 'pex-data-poa'"
read -p "#>>> " DATADIR
if [ ! "$DATADIR" ]
then
DATADIR=chain-poa
@ -15,15 +15,15 @@ echo ""
echo "Run geth in pm2? [y] for yes, [anything else] for raw geth:"
read -p ">>> " RUNPM2
read -p "#>>> " RUNPM2
echo "--- Creating ./$DATADIR/geth.ipc ..."
# http.addr 默认为 127.0.0.1 => 无法从远处连接。要用 0.0.0.0 才能从远处用 IP 连接。
# shh 是 whisper 协议,好像要先启动 websocket 接口才能启用。
while [ ! "$KEYCODE" ]
do
echo "=== Define chain keycode, for instance '882' for tuc chain:"
read -p ">>> " KEYCODE
echo "#<<< Define chain keycode, for instance '882' for tuc chain:"
read -p "#>>> " KEYCODE
done
if [ "$RUNPM2" == 'y' ]

View File

@ -2,7 +2,7 @@
echo "---------------------------------------------"
echo "User Name (leave blank for no change)"
read -p ">>> " UserName
read -p "#>>> " UserName
if [ $UserName ]
then
echo "git config --global user.name $UserName"
@ -11,7 +11,7 @@ fi
echo "---------------------------------------------"
echo "User Email (leave blank for no change)"
read -p ">>> " UserEmail
read -p "#>>> " UserEmail
if [ $UserEmail ]
then
echo "git config --global user.email $UserEmail"
@ -21,7 +21,7 @@ fi
echo "---------------------------------------------"
echo "如果 git 远程服务器的 ssl 证书过期,或者使用了自颁发的证书,连接时会出现验证错误 Cannot verify local issuer"
echo "Verify ssl? (true or false, blank for no change)"
read -p ">>> " HttpSslVerify
read -p "#>>> " HttpSslVerify
if [ $HttpSslVerify ]
then
echo "git config --global http.sslVerify $HttpSslVerify"
@ -30,7 +30,7 @@ fi
echo "---------------------------------------------"
echo "Store credential in cache or store? (leave blank for no change)"
read -p ">>> " CredentialHelper
read -p "#>>> " CredentialHelper
if [ $CredentialHelper ]
then
echo "git config --global credential.helper $CredentialHelper"
@ -39,7 +39,7 @@ fi
echo "---------------------------------------------"
echo "Store pull rebase to true or false? (leave blank for no change)"
read -p ">>> " PullRebase
read -p "#>>> " PullRebase
if [ $PullRebase ]
then
echo "git config --global pull.rebase $PullRebase"
@ -48,7 +48,7 @@ fi
echo "---------------------------------------------"
echo "Path to global gitignore file? (For example ~/.gitignore.global.txt, leave blank for no change)"
read -p ">>> " ExcludesFile
read -p "#>>> " ExcludesFile
if [ $ExcludesFile ]
then
echo "git config --global core.excludesfile $ExcludesFile"
@ -59,7 +59,7 @@ fi
echo "---------------------------------------------"
echo "Set default branch since git 2.28 to master or main? (leave blank for no change)"
read -p ">>> " DefaultBranch
read -p "#>>> " DefaultBranch
if [ $DefaultBranch ]
then
echo "git config --global init.defaultbranch $DefaultBranch"

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for .gitignore files
echo #<<< Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for .gitignore files
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
echo === Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]
echo #<<< Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
for /d /r %%r in (*) do (

View File

@ -8,8 +8,8 @@ if [ -d "$1" ]
then
ROOTPATH=$1
else
echo "=== Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories"
read -p "#>>> " ROOTPATH
if [ "$ROOTPATH" ]
then
ROOTPATH=$(realpath $ROOTPATH)
@ -26,8 +26,8 @@ else
fi
echo ""
echo "=== Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]"
read -p ">>> " IGNOREPATH
echo "#<<< Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]"
read -p "#>>> " IGNOREPATH
if [ "$IGNOREPATH" ]
then
if [ -d "$IGNOREPATH" ]
@ -46,8 +46,8 @@ else
fi
echo ""
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit

View File

@ -1,6 +1,6 @@
#!/bin/bash
echo === Merge remote [.gitignore.global.txt] and local [.gitignore.local.txt] to [.gitignore] ===
echo #<<< Merge remote [.gitignore.global.txt] and local [.gitignore.local.txt] to [.gitignore]
curl -sSL https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt > .gitignore
if [ -f .gitignore.local.txt ]; then cat .gitignore.local.txt >> .gitignore; fi;
echo

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path]> or [leave blank] for default to [[%CD%]]
echo #<<< Enter [root path]> or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,20 +23,20 @@ if not exist "%ROOTPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
@ if "%2" == "hier" (
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo #<<<===== entering [[%ROOTPATH%\%%o]]
echo;
pushd %%o
for /d %%g in (*) do (
if exist "%%g\.git" (
pushd %%g
echo ---- git pulling [[%ROOTPATH%\%%o\%%g]] ----
echo #<<<== git pulling [[%ROOTPATH%\%%o\%%g]]
git pull --all
echo;
popd
@ -51,7 +51,7 @@ echo;
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
pushd "%%r"
echo ---- git pulling [[%%r]] ----
echo #<<<== git pulling [[%%r]]
git pull --all
echo;
popd

View File

@ -5,8 +5,8 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p "#>>> " ROOTPATH
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
@ -23,8 +23,8 @@ else
fi
echo ""
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
@ -39,7 +39,7 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$ROOTPATH/$org]] ========"
echo "#<<<===== entering [[$ROOTPATH/$org]]"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,10 +23,10 @@ if not exist "%ROOTPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
echo === Enter [commit message] or [leave blank] for default to 'updated'
echo #<<< Enter [commit message] or [leave blank] for default to 'updated'
set /p COMMIT_MESSAGE=">>> "
@ if "" == "%COMMIT_MESSAGE%" (
set COMMIT_MESSAGE="updated"
@ -37,13 +37,13 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo #<<<== entering [[%ROOTPATH%\%%o]]
echo;
pushd "%%o"
for /d %%g in (*) do (
if exist %%g\.git (
pushd "%%g"
echo ---- git commit and push [[%ROOTPATH%\%%o\%%g]] ----
echo #---- git commit and push [[%ROOTPATH%\%%o\%%g]]
git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo;
popd
@ -58,7 +58,7 @@ echo;
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
pushd "%%r"
echo ---- git commit and push [[%%r]] ----
echo #<<<== git commit and push [[%%r]]
git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo;
popd

View File

@ -5,8 +5,8 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p "#>>> " ROOTPATH
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
@ -22,8 +22,8 @@ else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
@ -33,23 +33,23 @@ pushd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
echo "=== Enter [commit message] or [leave blank] for default to 'updated'"
read -p ">>> " COMMIT_MESSAGE
echo "#<<< Enter [commit message] or [leave blank] for default to 'updated'"
read -p "#>>> " COMMIT_MESSAGE
if [ ! "$COMMIT_MESSAGE" ]
then
COMMIT_MESSAGE="Update"
fi
echo ""
echo "=== Enter [h] for hierarchical, [r] for recursive, [anything else] for listing"
read -p ">>> " ACTION_TYPE
echo "#<<< Enter [h] for hierarchical, [r] for recursive, [anything else] for listing"
read -p "#>>> " ACTION_TYPE
if [ "$ACTION_TYPE" == 'h' ]
then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$ROOTPATH/$org]] ========"
echo "#<<<===== entering [[$ROOTPATH/$org]]"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path]> or [leave blank] for default to [[%CD%]]
echo #<<< Enter [root path]> or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,7 +23,7 @@ if not exist %ROOTPATH% (
)
pushd %ROOTPATH%
echo === Current path = [[%CD%]] ===
echo #<<< Current path = [[%CD%]]
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )

View File

@ -5,8 +5,8 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p "#>>> " ROOTPATH
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
@ -22,8 +22,8 @@ else
echo "√√√ ROOTPATH = [[$ROOTPATH]]"
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit
@ -36,7 +36,7 @@ echo ""
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$ROOTPATH/$org]] ========"
echo "#<<<===== entering [[$ROOTPATH/$org]]"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格

View File

@ -3,22 +3,22 @@
echo "in [REPOROOT]/*/*/hooks/[pre-receive.d|post-receive.d|update.d]/gitea, path is hard-coded in full such as `/faronear/git/gitea/gitea hook --config=/faronear/git/gitea/custom/conf/app.ini`, you need to replace it if the path is changed."
echo "[20230305] noticed that gitea 1.18.5 default is `/usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini`"
echo "=== Enter [old hook path string] or [leave blank] for default '/faronear/git/gitea/gitea':"
read -p ">>> " OLDPATH
echo "#<<< Enter [old hook path string] or [leave blank] for default '/faronear/git/gitea/gitea':"
read -p "#>>> " OLDPATH
if [ ! "$OLDPATH"]
then
OLDPATH=/faronear/git/gitea/gitea
fi
echo "=== Enter [new hook path string] or [leave blank] for default '/usr/local/bin/gitea': "
read -p ">>> " NEWPATH
echo "#<<< Enter [new hook path string] or [leave blank] for default '/usr/local/bin/gitea': "
read -p "#>>> " NEWPATH
if [ ! "$NEWPATH" ]
then
NEWPATH=/usr/local/bin/gitea
fi
echo "=== Enter [root path] of repositories, or [leave blank] for default [[]]`pwd`]] "
read -p ">>> " REPOROOT
echo "#<<< Enter [root path] of repositories, or [leave blank] for default [[]]`pwd`]] "
read -p "#>>> " REPOROOT
if [ "$ROOTPATH"]
then
ROOTPATH=`realpath $ROOTPATH`
@ -26,8 +26,8 @@ else
ROOTPATH=`pwd`
fi
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit

View File

@ -1,5 +1,5 @@
echo '>>>> Starting gitea ...'
echo '#>>>> Starting gitea ...'
cd /faronear/git/gitea
pm2 start -x './gitea' --name gitea -- web
echo '>>>> Started gitea.'
echo '#>>>> Started gitea.'

View File

@ -1,13 +1,13 @@
# 服务化方案1: screen
#echo '>>> Starting gogs in screen ...'
#echo '#>>> Starting gogs in screen ...'
#screen -dmS gogs
#screen -S gogs -X stuff "/faronear/gogs/gogs web\n"
# 服务化方案2: pm2
echo '>>>> Starting gogs in pm2 ...'
echo '#>>>> Starting gogs in pm2 ...'
cd /faronear/git/gogs # 如果在 /faronear/git 中运行 ./gogs/gogs导致额外生成 /faronear/git/data 目录。
# sudo it so that pm2 list shows it as root
sudo pm2 start -x './gogs' --name git.gogs -- web
cd /faronear/git
echo '>>>> Started gogs.'
echo '#>>>> Started gogs.'

View File

@ -6,8 +6,8 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Enter kubo [version number] or [leave blank] for default $defaultVERSION"
read -p ">>> " VERSION
echo "#<<< Enter kubo [version number] or [leave blank] for default $defaultVERSION"
read -p "#>>> " VERSION
if [ ! $VERSION ]
then
VERSION=$defaultVERSION

View File

@ -1,11 +1,11 @@
echo "=== Install formulaes and casks, enter [y] for Yes, [anything else] for No:"
echo "#<<< Install formulaes and casks, enter [y] for Yes, [anything else] for No:"
echo
formulaeList=(jq openssl pandoc rclone speedtest-cli yt-dlp)
formulaeList=(cloudflared jq openssl pandoc rclone readline speedtest-cli hudochenkov/sshpass/sshpass v2ray v2raya/v2raya/v2raya yt-dlp)
for APP in "${formulaeList[@]}"
do
echo "--- brew install $APP"
read -p ">>> " YN
read -p "#>>> " YN
if [ "$YN" = 'y' ]
then
brew install $APP
@ -15,11 +15,11 @@ do
echo
done
caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin drawio emacs futubull iina iterm2 lx-music miniconda obs poe qq seafile-client shotcut spacelauncher sqlitestudio telegram-desktop telegram-lite termius thunder warp wechat)
caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin drawio emacs futubull mysql-client iina iterm2 lx-music miniconda obs poe qq seafile-client shotcut spacelauncher sqlitestudio telegram-desktop termius thunder warp wechat xquartz)
for APP in "${caskList[@]}"
do
echo "--- brew install $APP --cask"
read -p ">>> " YN
read -p "#>>> " YN
if [ "$YN" = 'y' ]
then
brew install $APP

View File

@ -1,5 +1,5 @@
echo === Enter [g] to reset git source to github, [a] to 阿里云, [z] to 中科大, [q] to 清华, [anything else] to quit:
read -p '>>> ' TARGET
echo #<<< Enter [g] to reset git source to github, [a] to 阿里云, [z] to 中科大, [q] to 清华, [anything else] to quit:
read -p '#>>> ' TARGET
if [ "$TARGET" = 'g' ]
then

View File

@ -1,13 +1,13 @@
echo "=== Enter [row number] (7 for MBA, 9 for iMac) or [leave blank] for default to 9"
read -p ">>> " ROWS
echo "#<<< Enter [row number] (7 for MBA, 9 for iMac) or [leave blank] for default to 9"
read -p "#>>> " ROWS
if [ "$ROWS" = "" ]
then
ROWS=9
fi
defaults write com.apple.dock springboard-rows -int $ROWS
echo "=== Enter [column number] (10 for MBA, 15 for iMac) or [leave blank] for default to 15"
read -p ">>> " COLS
echo "#<<< Enter [column number] (10 for MBA, 15 for iMac) or [leave blank] for default to 15"
read -p "#>>> " COLS
if [ "$COLS" = "" ]
then
COLS=15

View File

@ -1,32 +1,28 @@
#!/bin/bash
NIXHOME0=/faronear/sysconfig/nixhome
NIXHOME1=~/sysconfig/nixhome
NIXHOME2=`pwd`/nixhome
if [ -d "$1" ]
then
NIXHOME=$1
elif [ -d $NIXHOME0 ]
else if [ -d "`pwd`/nixhome" ]
then
NIXHOME=$NIXHOME0
elif [ -d $NIXHOME1 ]
then
NIXHOME=$NIXHOME1
elif [ -d $NIXHOME2 ]
then
NIXHOME=$NIXHOME2
NIXHOME=`pwd`/nixhome
else
echo ××× none of the testing path is valid.
echo "=== Enter [nixhome path] or leave [blank] to exit"
read -p ">>> " NIXHOME
echo ""
if [ ! -d "$NIXHOME" ]
then
echo "××× nixhome path [[$NIXHOME]] not available! Exit now. ×××"
exit
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p "#>>> " NIXHOME
if [ ! "$NIXHOME" ]
then
NIXHOME=`pwd`
fi
fi
if [ ! -e "$NIXHOME/.bashrc" ]
then
echo "××× [[$NIXHOME/.bashrc]] not exist! Exit now. ***"
exit
else
echo "√√√ NIXHOME = [[$NIXHOME]]"
fi
echo ""
# $2 应当为用户名
if [ "$2" == 'root' ]
@ -50,8 +46,8 @@ then
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore.global.txt"
echo
echo "=== Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p ">>> " CopyOrLinkScripts
echo "#<<< Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p "#>>> " CopyOrLinkScripts
if [ "$CopyOrLinkScripts" == 'l' ]
then
for homescript in $homescriptlist
@ -108,8 +104,8 @@ then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi
echo "=== Append or link or omit [[$HomePath/.ssh/authorized_keys]] to config ssh server? [a] for append, [l] for link, [anything else] for omit:"
read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys
echo "#<<< Append or link or omit [[$HomePath/.ssh/authorized_keys]] to config ssh server? [a] for append, [l] for link, [anything else] for omit:"
read -p "#>>> " CopyOrLinkOrOmitAuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]
then

View File

@ -46,7 +46,7 @@ alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias su='su -'
alias npmc='npm --registry https://registry.npmmirror.com'
alias npmr='npm --silent run'
alias npmr='npm -s run'
alias curlw='curl -sSL -o /dev/null -w "%{http_code} | %{time_total} s | %{size_download} bytes | %{url_effective}\n"'
if [ "$(uname)" = "Darwin" ]
then
@ -112,9 +112,28 @@ if [ -n "$force_color_prompt" ]; then
fi
fi
# color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style$Type$Code`, for example, $Style=01; means text in bold, $Type=3 means text color, $Type=4 means background color, $Code could be 0-7 for pre-defined colors.
# color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style;$Type$Color`:
# $Style: text style
# - `00`: Default style
# - `01`: Bold/Bright
# - `04`: Underlined
# - `05`: Blink (may not work in all terminals)
# - `07`: Inverse
# - `08`: Hidden
# $Type:
# - `3`: text
# - `4`: background
# $Color: color
# - `0`: Black
# - `1`: Red
# - `2`: Green
# - `3`: Yellow
# - `4`: Blue
# - `5`: Magenta
# - `6`: Cyan
# - `7`: White
if [ "$color_prompt" = yes ]; then
PS1='<\[\033[01;42m\]\t\[\033[00m\]#\[\033[01;43m\]\u\[\033[00m\]@\[\033[01;46m\]\h\[\033[00m\]:\[\033[01;41m\]\w\[\033[00m\]> '
PS1='<\[\033[01;42m\]\t\[\033[00m\]#\[\033[01;45m\]\u\[\033[00m\]@\[\033[01;41m\]\h\[\033[00m\]:\[\033[01;41m\]\w\[\033[00m\]> '
else
PS1='<\t#\u@\h:\w> '
fi

View File

@ -1 +0,0 @@
registry=https://registry.npmmirror.com

View File

@ -22,6 +22,8 @@
*.nosf/
*.nosf.*/
.Trash/
.DS_Store
*/.DS_Store
@ -54,6 +56,9 @@ pages4loader.json5
.deploy_git/
*/.deploy_git/
# next.js 项目
.next/
# HBuilder 目录
unpackage/
*/unpackage/

View File

@ -8,8 +8,8 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools"
read -p ">>> " VERSION
echo "#<<< Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools"
read -p "#>>> " VERSION
if [ ! $VERSION ]
then
VERSION=$defaultVERSION

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,21 +23,21 @@ if not exist "%ROOTPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
@ if "%2" == "hier" (
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do if exist %%d/package.json ( pushd %%d & echo --- npm booting: %%d ... & npm run boot & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [[%ROOTPATH%\%%o]] ========
echo #<<<===== entering [[%ROOTPATH%\%%o]]
echo;
pushd %%o
for /d %%g in (*) do (
@ if exist "%%g\package.json" (
findstr "\"boot\"" %%g\package.json >NUL && (
pushd %%g
echo ---- npm booting [[%ROOTPATH%\%%o\%%g]] ----
echo #<<<== npm booting [[%ROOTPATH%\%%o\%%g]]
npm run boot
echo;
popd
@ -54,7 +54,7 @@ echo;
if exist "%%r\package.json" (
findstr "\"boot\"" "%%r\package.json" >NUL && (
pushd %%r
echo ---- npm booting [[%ROOTPATH%\%%r]] ----
echo #<<<== npm booting [[%ROOTPATH%\%%r]]
npm run boot
echo;
popd

View File

@ -5,8 +5,8 @@ then
ROOTPATH=$1
else
echo ""
echo "=== Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]"
read -p "#>>> " ROOTPATH
if [ ! "$ROOTPATH" ]
then
ROOTPATH=`pwd`
@ -30,7 +30,7 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [[$ROOTPATH/$org]] ========"
echo "#<<<===== entering [[$ROOTPATH/$org]]"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
@ -40,7 +40,7 @@ then
echo "<<<< npm booting: [[$org/$repo]] <<<<"
cd "$repo"
npm run boot
echo ">>>> npm booted: [[$org/$repo]] >>>>"
echo "#>>>> npm booted: [[$org/$repo]] #>>>>"
echo ""
cd ..
fi

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path] or [leave blank] for default to [[%CD%]]
echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -22,7 +22,7 @@ if not exist "%ROOTPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
for /d /r %%r in (*) do (

View File

@ -9,10 +9,10 @@ echo nrm ls
echo nrm current
echo
echo "=== npm config get registry ==> $(npm config get registry)"
echo "#<<< npm config get registry ==> $(npm config get registry)"
echo
echo "=== npm config set registry \n [c] China, \n [w] World, [anything else] to quit"
read -p ">>> " TARGET
echo "#<<< npm config set registry \n [c] China, \n [w] World, [anything else] to quit"
read -p "#>>> " TARGET
if [ "$TARGET" = 'c' ]
then
npm config set registry https://registry.npmmirror.com
@ -21,4 +21,4 @@ then
npm config set registry https://registry.npmjs.org
fi
echo
echo "=== npm config get registry ==> $(npm config get registry)"
echo "#<<< npm config get registry ==> $(npm config get registry)"

View File

@ -1,7 +1,7 @@
@ if not "" == "%1" (
set PORT=%1
) else (
echo === Enter [port] to scan:
echo #<<< Enter [port] to scan:
set /p PORT=">>> "
echo;
)

View File

@ -2,8 +2,8 @@ if [ "$1" ]
then
PORT=$1
else
echo "=== 需要查看的端口号:"
read -p ">>> " PORT
echo "#<<< 需要查看的端口号:"
read -p "#>>> " PORT
fi
if [ "$(uname)" = "Darwin" ]

View File

@ -1,7 +1,7 @@
@REM 在 powershell 里,只要 ssr 打开全局模式,不需要设置 proxy 就可以。
@REM 在 cmd 里,需要设置 proxy 才可以。
echo === Enter [s] to start, [t] to terminate or [anything else] for no change
echo #<<< Enter [s] to start, [t] to terminate or [anything else] for no change
set /p TODOMODE=">>> "
echo;
if "s" == "%TODOMODE%" (

View File

@ -1,26 +1,26 @@
#!/bin/bash
echo "=== Please run with 'source proxy.sh', otherwise it has no effect on the current shell"
echo "#<<< Please run with 'source proxy.sh', otherwise it has no effect on the current shell"
if [ -n "$1" ]; then
proxySwitch="$1"
else
echo "=== 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change."
read -p ">>> " proxySwitch
echo "#<<< 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change."
read -p "#>>> " proxySwitch
fi
# to reset port to empty, otherwise the second run of this script will not ask for port.
PORT=
PORTDEFAULT=20170
# function proxy() {
if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then
echo "=== Proxy server running on [port number] or [leave blank] for default 7897"
echo "#<<< Proxy server running on [port number] or [leave blank] for default $PORTDEFAULT (20170 for v2ray2, or 7897 for clash verge)"
while [ ! "$PORT" ]
do
read -p ">>> " PORT
read -p "#>>> " PORT
if [ ! "$PORT" ]
then
PORT=7897
PORT=$PORTDEFAULT
fi
done
export all_proxy=socks5://127.0.0.1:$PORT

View File

@ -1,7 +1,7 @@
#!/bin/bash
echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit"
read -p ">>> " ACTION_TYPE
echo "#<<< rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit"
read -p "#>>> " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ]
then
sudo -v ; curl https://rclone.org/install.sh | sudo bash
@ -16,30 +16,30 @@ then
fi
echo
echo "=== from source (default ./)"; read -p ">>> " SOURCE_PATH; if [ ! "$SOURCE_PATH" ]; then SOURCE_PATH="./"; fi
echo "#<<< from source (default ./)"; read -p "#>>> " SOURCE_PATH; if [ ! "$SOURCE_PATH" ]; then SOURCE_PATH="./"; fi
echo
while [ ! "$TARGET_PATH" ]
do
echo "=== to target [remote:path]"
read -p ">>> " TARGET_PATH
echo "#<<< to target [remote:path]"
read -p "#>>> " TARGET_PATH
done
# read -p "rclone $RC_CMD with max-age >>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件
# read -p "rclone $RC_CMD with max-age #>>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件
echo
echo "excluding files and folders (folders must end with /)"
read -p ">>> " EXCLUDING;
read -p "#>>> " EXCLUDING;
echo
echo "with [number] files in parallel, default 4"
read -p ">>> " TRANSFERS;
read -p "#>>> " TRANSFERS;
if [ ! "$TRANSFERS" ]; then TRANSFERS=4; fi
echo
echo "with [number] threads simultaneously, default 4";
read -p ">>> " THREADS;
read -p "#>>> " THREADS;
if [ ! "$THREADS" ]; then THREADS=4; fi
FULL_CMD="rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --transfers=$TRANSFERS --multi-thread-streams=$THREADS --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}"
@ -50,7 +50,7 @@ then
echo "*****************************"
echo
echo "Starting? [y] for yes, [anything else] for quit"
read -p ">>> " YES_OR_NOT
read -p "#>>> " YES_OR_NOT
echo
if [ "$YES_OR_NOT" = 'y' ]
then

View File

@ -2,8 +2,8 @@ if [ $1 ]
then
NewHostname=$1
else
echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname
echo "#<<< Set [new hostname] or [leave blank] for no change"
read -p "#>>> " NewHostname
fi
if [ $NewHostname ]
@ -11,6 +11,6 @@ then
hostnamectl set-hostname $NewHostname
sed -i "s|\b$`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts
else
echo 'Nothing changed >>>'
echo 'Nothing changed #>>>'
fi
echo

View File

@ -1,6 +1,6 @@
@echo off
echo === Append ~/.ssh/id_rsa.pub to remote server ===
echo #<<< Append ~/.ssh/id_rsa.pub to remote server
@ if not "%1" == "" (
set REMOTEHOST=%1

View File

@ -6,8 +6,8 @@ if [ $1 ]
then
REMOTEHOST=$1
else
echo "=== Enter << user@remotehost >> to connect to:"
read -p ">>> " REMOTEHOST
echo "#<<< Enter << user@remotehost >> to connect to:"
read -p "#>>> " REMOTEHOST
fi
scp ~/.ssh/id_rsa.pub $REMOTEHOST:~/tmp.pub

View File

@ -4,7 +4,7 @@ sudo apt update
sudo apt install -y seafile-cli
echo "To initialze the client, create a settings folder at [settings path] or [leave blank] for default '~/seafile-client'"
read -p ">>> " SETTINGS_FOLDER
read -p "#>>> " SETTINGS_FOLDER
if [ ! $SETTINGS_FOLDER ]
then
SETTINGS_FOLDER = ~/seafile-client

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1
) else (
echo;
echo === Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for seafile-ignore.txt files
echo #<<< Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for seafile-ignore.txt files
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
echo === Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]
echo #<<< Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]
set /p IGNOREPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" (
)
pushd %ROOTPATH%
echo === Starting from [[%CD%]] ===
echo #<<< Starting from [[%CD%]]
echo;
for /d /r %%r in (*) do (

View File

@ -8,8 +8,8 @@ if [ -d "$1" ]
then
ROOTPATH=$1
else
echo "=== Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files"
read -p ">>> " ROOTPATH
echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files"
read -p "#>>> " ROOTPATH
if [ "$ROOTPATH" ]
then
ROOTPATH=$(realpath $ROOTPATH)
@ -26,8 +26,8 @@ else
fi
echo ""
echo "=== Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
read -p ">>> " IGNOREPATH
echo "#<<< Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
read -p "#>>> " IGNOREPATH
if [ "$IGNOREPATH" ]
then
if [ -d "$IGNOREPATH" ]
@ -46,8 +46,8 @@ else
fi
echo ""
echo "=== Enter [y] to start updating, or [anything else] to quit"
read -p ">>> " YESNO
echo "#<<< Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO
if [ "$YESNO" != 'y' ]
then
exit

View File

@ -1,6 +1,6 @@
#!/bin/bash
echo === Merge remote [seafile-ignore.global.txt] and local [seafile-ignore.local.txt] to [seafile-ignore.txt] ===
echo #<<< Merge remote [seafile-ignore.global.txt] and local [seafile-ignore.local.txt] to [seafile-ignore.txt]
curl -sSL https://git.faronear.org/npm/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

View File

@ -1,5 +1,7 @@
#!/bin/bash
echo Usage: this_script.sh [selected_index] [to_run_cmd]
# Ensure jq is installed
if ! command -v jq &> /dev/null; then
echo "jq is required but not installed. Please install jq and run the script again."
@ -24,8 +26,10 @@ fi
# Parse the JSON to get labels and corresponding details
labels=($(jq -r '.["sshfs.configs"][] | .label' "$SETTINGS_FILE"))
hosts=($(jq -r '.["sshfs.configs"][] | .host' "$SETTINGS_FILE"))
ports=($(jq -r '.["sshfs.configs"][] | .port' "$SETTINGS_FILE"))
names=($(jq -r '.["sshfs.configs"][] | .name' "$SETTINGS_FILE"))
usernames=($(jq -r '.["sshfs.configs"][] | .username' "$SETTINGS_FILE"))
passwords=($(jq -r '.["sshfs.configs"][] | .password' "$SETTINGS_FILE"))
privateKeyPaths=($(jq -r '.["sshfs.configs"][] | .privateKeyPath' "$SETTINGS_FILE"))
if [ "$1" -ge 0 ] 2>/dev/null && [ "$1" -le ${#hosts[@]} ] 2>/dev/null
@ -47,9 +51,23 @@ fi
label="${labels[$selected_index]}"
name="${names[$selected_index]}"
host="${hosts[$selected_index]}"
port="${ports[$selected_index]}"
username="${usernames[$selected_index]}"
password="${passwords[$selected_index]}"
privateKeyPath="${privateKeyPaths[$selected_index]}"
echo "=== Coonecting to ${label}"
echo ">>> ssh $username@$host"
ssh "$username@$host"
if [ "$port" = "null" ]
then
port=22
fi
if [ "$password" != "" ] & [ "$(which sshpass)" != "" ]
then
echo "#<<< Coonecting to ${label} with password"
echo "#>>> ssh -X -p $port $username@$host"
sshpass -p $password ssh -X -p $port "$username@$host" $2
else
echo "#<<< Coonecting to ${label} with private key"
echo "#>>> ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2
fi

View File

@ -1,11 +1,11 @@
#!/bin/bash
echo === 把 HBuilder 创建的 uniapp 应用转换成 vue-cli 应用的脚手架。
echo === More info at https://uniapp.dcloud.net.cn/quickstart-cli.html
echo #<<< 把 HBuilder 创建的 uniapp 应用转换成 vue-cli 应用的脚手架。
echo #<<< More info at https://uniapp.dcloud.net.cn/quickstart-cli.html
echo === CLI project name?
read -p '>>> ' PROJECT
echo #<<< CLI project name?
read -p '##>>> ' PROJECT
if [ $PROJECT ]
then
@ -13,14 +13,14 @@ then
vue create -p dcloudio/uni-preset-vue $PROJECT
cd $PROJECT
mv src src-old
echo === Originial Repository URL?
read -p '>>> ' $url
echo #<<< Originial Repository URL?
read -p '#>>> ' $url
echo
echo === 下载一个 HBuilderX 创建的项目下载存为 src 目录:
echo #<<< 下载一个 HBuilderX 创建的项目下载存为 src 目录:
echo
git clone $url src
echo
echo === 进入 src 安装依赖库
echo #<<< 进入 src 安装依赖库
cd src
npm run boot
cd ..