change === and >>> to ::*** and ***::

This commit is contained in:
Luk 2024-12-21 15:01:18 +08:00
parent c063e02f1e
commit edb1f40cf1
51 changed files with 285 additions and 299 deletions

View File

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

View File

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

View File

@ -5,8 +5,8 @@ echo
NewUser=$1 NewUser=$1
while [ ! "$NewUser" ] while [ ! "$NewUser" ]
do do
echo "#<<< To add a new user of name:" echo "::*** To add a new user of name:"
read -p "#>>> " NewUser read -p "***:: " NewUser
done done
useradd $NewUser 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 # Debian 9 default to empty
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd 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" echo "::*** Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p "#>>> " AllowSudo read -p "***:: " AllowSudo
if [ "$AllowSudo" = "y" ] if [ "$AllowSudo" = "y" ]
then then
#usermod -a -G sudo $NewUser # Add to sudo group # Option 1: add user to %sudo group #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 "Thanks https://github.com/bohanyang/debi"
echo echo
echo "#<<< Enter debian version [8,9,10,11] or [leave blank] for 11" echo "::*** Enter debian version [8,9,10,11] or [leave blank] for 11"
read -p "#>>> " DEBIAN_VERSION read -p "***:: " DEBIAN_VERSION
if [ -z "${DEBIAN_VERSION}" ] if [ -z "${DEBIAN_VERSION}" ]
then then
DEBIAN_VERSION=11 DEBIAN_VERSION=11
@ -23,8 +23,8 @@ ARCH=`dpkg --print-architecture`
# ARCH=amd64 # ARCH=amd64
# fi # fi
echo "#<<< Enter presets to download from [cdn, aws, china] or [leave blank] for cdn" echo "::*** Enter presets to download from [cdn, aws, china] or [leave blank] for cdn"
read -p "#>>> " PRESET read -p "***:: " PRESET
if [ -z "${PRESET}" ] if [ -z "${PRESET}" ]
then then
PRESET=cdn 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 可省略,则脚本启动后会问你要密码 sudo ./debi.sh --version $DEBIAN_VERSION --architecture `dpkg --print-architecture` --user root --$PRESET # --architecture 可参略或者[amd64默认, i386, arm64, armhf]--password 可省略,则脚本启动后会问你要密码
echo echo
echo "#<<< Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes" echo "::*** Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes"
read -p "#>>> " LAST read -p "***:: " LAST
if [ 'r' = "$LAST" ] if [ 'r' = "$LAST" ]
then 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 sudo shutdown -r now
else 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; } 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

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

View File

@ -1,30 +1,30 @@
#!/bin/bash #!/bin/bash
echo "#>>> cat /etc/issue" echo "::*** cat /etc/issue"
cat /etc/issue cat /etc/issue
echo echo
echo "#>>> cat /etc/debian_version" echo "::*** cat /etc/debian_version"
cat /etc/debian_version cat /etc/debian_version
echo echo
echo "#>>> cat /etc/os-release" echo "::*** cat /etc/os-release"
cat /etc/os-release cat /etc/os-release
echo echo
echo "#>>> cat /etc/cpuinfo" echo "::*** cat /etc/cpuinfo"
cat /etc/cpuinfo cat /etc/cpuinfo
echo echo
# echo "#>>> lsb-release" # echo "::*** lsb-release"
# apt install lsb-release # apt install lsb-release
# lsb-release -a # lsb-release -a
# echo # echo
echo "#>>> hostnamectl" echo "::*** hostnamectl"
hostnamectl hostnamectl
echo echo
echo "#>>> uname -a" echo "::*** uname -a"
uname -a uname -a
echo 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" ] if [ "$1" ]
then then
DOCKERUSER=$1 DOCKERUSER=$1
else else
echo "Enter the [user name] or [leave blank] for default to '`whoami`'" echo "Enter the [user name] or [leave blank] for default to '`whoami`'"
read -p "#>>> " DOCKERUSER read -p "***:: " DOCKERUSER
if [ ! "$DOCKERUSER" ] if [ ! "$DOCKERUSER" ]
then then
DOCKERUSER=`whoami` DOCKERUSER=`whoami`

View File

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

View File

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

View File

@ -23,8 +23,8 @@ else
echo " sh : $sh" echo " sh : $sh"
echo " wx : $wx" echo " wx : $wx"
echo echo
echo "#<<< Enter target (leave blank to specify host/user/pwd):" echo "::*** Enter target (leave blank to specify host/user/pwd):"
read -p "#>>> " TARGET read -p "***:: " TARGET
if [ ! $TARGET ] if [ ! $TARGET ]
then then
TARGET=other TARGET=other

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1 set ROOTPATH=%1
) else ( ) else (
echo; 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=">>> " set /p ROOTPATH=">>> "
echo; echo;
if "" == "%ROOTPATH%" ( if "" == "%ROOTPATH%" (
@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" (
echo √√√ ROOTPATH = [[%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=">>> " set /p IGNOREPATH=">>> "
echo; echo;
if "" == "%IGNOREPATH%" ( if "" == "%IGNOREPATH%" (
@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" (
) )
pushd %ROOTPATH% pushd %ROOTPATH%
echo #<<< Starting from [[%CD%]] echo ::*** Starting from [[%CD%]]
echo; echo;
for /d /r %%r in (*) do ( for /d /r %%r in (*) do (

View File

@ -8,8 +8,8 @@ if [ -d "$1" ]
then then
ROOTPATH=$1 ROOTPATH=$1
else else
echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories" echo "::*** Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories"
read -p "#>>> " ROOTPATH read -p "***:: " ROOTPATH
if [ "$ROOTPATH" ] if [ "$ROOTPATH" ]
then then
ROOTPATH=$(realpath $ROOTPATH) ROOTPATH=$(realpath $ROOTPATH)
@ -26,8 +26,8 @@ else
fi fi
echo "" 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]]" 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 read -p "***:: " IGNOREPATH
if [ "$IGNOREPATH" ] if [ "$IGNOREPATH" ]
then then
if [ -d "$IGNOREPATH" ] if [ -d "$IGNOREPATH" ]
@ -46,8 +46,8 @@ else
fi fi
echo "" echo ""
echo "#<<< Enter [y] to start updating, or [anything else] to quit" echo "::*** Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO read -p "***:: " YESNO
if [ "$YESNO" != 'y' ] if [ "$YESNO" != 'y' ]
then then
exit exit

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/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 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; if [ -f .gitignore.local.txt ]; then cat .gitignore.local.txt >> .gitignore; fi;
echo echo

View File

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

View File

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

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1 set ROOTPATH=%1
) else ( ) else (
echo; 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=">>> " set /p ROOTPATH=">>> "
echo; echo;
if "" == "%ROOTPATH%" ( if "" == "%ROOTPATH%" (
@ -23,10 +23,10 @@ if not exist "%ROOTPATH%" (
) )
pushd %ROOTPATH% pushd %ROOTPATH%
echo #<<< Starting from [[%CD%]] echo ::*** Starting from [[%CD%]]
echo; 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=">>> " set /p COMMIT_MESSAGE=">>> "
@ if "" == "%COMMIT_MESSAGE%" ( @ if "" == "%COMMIT_MESSAGE%" (
set COMMIT_MESSAGE="updated" set COMMIT_MESSAGE="updated"
@ -37,7 +37,7 @@ 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 ) @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 ( for /d %%o in (*) do (
@ if not "%%o" == ".vscode" ( @ if not "%%o" == ".vscode" (
echo #<<<== entering [[%ROOTPATH%\%%o]] echo ::***** entering [[%ROOTPATH%\%%o]]
echo; echo;
pushd "%%o" pushd "%%o"
for /d %%g in (*) do ( for /d %%g in (*) do (
@ -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 || ( echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" ( if exist "%%r\.git" (
pushd "%%r" pushd "%%r"
echo #<<<== git commit and push [[%%r]] echo ::***** git commit and push [[%%r]]
git add . && git commit -m "%COMMIT_MESSAGE%" && git push git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo; echo;
popd popd

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ if [ $1 ]
then then
VERSION=$1 VERSION=$1
else else
echo "#<<< Enter kubo [version number] or [leave blank] for default $defaultVERSION" echo "::*** Enter kubo [version number] or [leave blank] for default $defaultVERSION"
read -p "#>>> " VERSION read -p "***:: " VERSION
if [ ! $VERSION ] if [ ! $VERSION ]
then then
VERSION=$defaultVERSION 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 echo
formulaeList=(cloudflared jq openssl pandoc rclone readline speedtest-cli hudochenkov/sshpass/sshpass v2ray v2raya/v2raya/v2raya yt-dlp) formulaeList=(cloudflared jq openssl pandoc rclone readline speedtest-cli hudochenkov/sshpass/sshpass v2ray v2raya/v2raya/v2raya yt-dlp)
for APP in "${formulaeList[@]}" for APP in "${formulaeList[@]}"
do do
echo "--- brew install $APP" echo "--- brew install $APP"
read -p "#>>> " YN read -p "***:: " YN
if [ "$YN" = 'y' ] if [ "$YN" = 'y' ]
then then
brew install $APP brew install $APP
@ -19,7 +19,7 @@ caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin
for APP in "${caskList[@]}" for APP in "${caskList[@]}"
do do
echo "--- brew install $APP --cask" echo "--- brew install $APP --cask"
read -p "#>>> " YN read -p "***:: " YN
if [ "$YN" = 'y' ] if [ "$YN" = 'y' ]
then then
brew install $APP 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: echo ::*** Enter [g] to reset git source to github, [a] to 阿里云, [z] to 中科大, [q] to 清华, [anything else] to quit:
read -p '#>>> ' TARGET read -p '***:: ' TARGET
if [ "$TARGET" = 'g' ] if [ "$TARGET" = 'g' ]
then then

View File

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

View File

@ -1,22 +1,19 @@
#!/bin/bash #!/bin/bash
if [ -d "$1" ] if [ -d "$1" ]; then
then
NIXHOME=$1 NIXHOME=$1
else if [ -d "`pwd`/nixhome" ] elif [ -d "$(pwd)/nixhome" ]; then
then NIXHOME=$(pwd)/nixhome
NIXHOME=`pwd`/nixhome
else else
echo "" echo ""
echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" echo "::*** Enter [root path] or [leave blank] for default to [[$(pwd)]]"
read -p "#>>> " NIXHOME read -p "***:: " NIXHOME
if [ ! "$NIXHOME" ] if [ -z "$NIXHOME" ]; then
then NIXHOME=$(pwd)
NIXHOME=`pwd`
fi fi
fi fi
if [ ! -e "$NIXHOME/.bashrc" ]
then if [ ! -e "$NIXHOME/.bashrc" ]; then
echo "××× [[$NIXHOME/.bashrc]] not exist! Exit now. ***" echo "××× [[$NIXHOME/.bashrc]] not exist! Exit now. ***"
exit exit
else else
@ -25,60 +22,48 @@ fi
echo "" echo ""
# $2 应当为用户名 # $2 应当为用户名
if [ "$2" == 'root' ] if [ "$2" == 'root' ]; then
then
HomePath=/root HomePath=/root
TheUser=root TheUser=root
elif [ "$2" ] elif [ "$2" ]; then
then
HomePath=/home/$2 HomePath=/home/$2
TheUser=$2 TheUser=$2
else else
# 可能是 root 或其他 # 可能是 root 或其他
HomePath=~ HomePath=~
TheUser=`whoami` TheUser=$(whoami)
fi fi
if [ -d "$HomePath" ] if [ -d "$HomePath" ]; then
then
pushd $HomePath pushd "$HomePath"
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore.global.txt" homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore.global.txt"
echo echo
echo "#<<< Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:" echo "::*** Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p "#>>> " CopyOrLinkScripts read -p "***:: " CopyOrLinkScripts
if [ "$CopyOrLinkScripts" == 'l' ] if [ "$CopyOrLinkScripts" == 'l' ]; then
then for homescript in $homescriptlist; do
for homescript in $homescriptlist if [ -e "$homescript" ] || [ -L "$homescript" ]; then
do mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
if [ -e "$homescript" ] || [ -L "$homescript" ]
then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
ln -s $NIXHOME/$homescript ./ ln -s "$NIXHOME/$homescript" ./
done done
elif [ "$CopyOrLinkScripts" == 'c' ] elif [ "$CopyOrLinkScripts" == 'c' ]; then
then for homescript in $homescriptlist; do
for homescript in $homescriptlist if [ -e "$homescript" ] || [ -L "$homescript" ]; then
do mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
if [ -e "$homescript" ] || [ -L "$homescript" ]
then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
cp -r $NIXHOME/$homescript ./ cp -r "$NIXHOME/$homescript" ./
done done
elif [ "$CopyOrLinkScripts" == 'g' ] elif [ "$CopyOrLinkScripts" == 'g' ]; then
then for homescript in $homescriptlist; do
for homescript in $homescriptlist if [ -e "$homescript" ] || [ -L "$homescript" ]; then
do mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
if [ -e "$homescript" ] || [ -L "$homescript" ]
then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi fi
curl -sSLO https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/$homescript curl -sSLO "https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/$homescript"
done done
else else
echo '--- Home scripts not changed.' echo '--- Home scripts not changed.'
@ -86,37 +71,31 @@ then
echo echo
if [ "$(uname)" == "Darwin" ] if [ "$(uname)" == "Darwin" ]; then
then
echo '--- No need to configure ./ssh/authorized_keys on Mac OS X. Exit now.' echo '--- No need to configure ./ssh/authorized_keys on Mac OS X. Exit now.'
elif [ "$TheUser" != 'root' ] # 仅允许 non-root 用户进行远程密钥登录 elif [ "$TheUser" != 'root' ]; then
then
mkdir -p $HomePath/.ssh mkdir -p "$HomePath/.ssh"
chmod 700 $HomePath/.ssh chmod 700 "$HomePath/.ssh"
if [ "$2" ] if [ "$2" ]; then
then
# 由 root 指定新用户而创建的配置文件的 owner 是 root而不是新用户导致新用户无法读取该文件而密钥登录失败因此要重设 owner。 # 由 root 指定新用户而创建的配置文件的 owner 是 root而不是新用户导致新用户无法读取该文件而密钥登录失败因此要重设 owner。
chown $TheUser:$TheUser $HomePath/.ssh chown "$TheUser:$TheUser" "$HomePath/.ssh"
fi fi
if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ] if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]; then
then mv "$HomePath/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi 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:" 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 read -p "***:: " CopyOrLinkOrOmitAuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ] if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]; then
then
echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..." echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
ln -s $NIXHOME/.ssh/authorized_keys $HomePath/.ssh/authorized_keys ln -s "$NIXHOME/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys"
sudo chmod 644 $HomePath/.ssh/authorized_keys # 确保其他用户能读取 nixhome/.ssh/authorized_keys sudo chmod 644 "$HomePath/.ssh/authorized_keys" # 确保其他用户能读取 nixhome/.ssh/authorized_keys
elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ] elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ]; then
then
echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..." echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
cat $NIXHOME/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys cat "$NIXHOME/.ssh/authorized_keys" >> "$HomePath/.ssh/authorized_keys"
chmod 600 $HomePath/.ssh/authorized_keys chmod 600 "$HomePath/.ssh/authorized_keys"
fi fi
echo echo

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1 set ROOTPATH=%1
) else ( ) else (
echo; 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=">>> " set /p ROOTPATH=">>> "
echo; echo;
if "" == "%ROOTPATH%" ( if "" == "%ROOTPATH%" (
@ -22,7 +22,7 @@ if not exist "%ROOTPATH%" (
) )
pushd %ROOTPATH% pushd %ROOTPATH%
echo #<<< Starting from [[%CD%]] echo ::*** Starting from [[%CD%]]
echo; echo;
for /d /r %%r in (*) do ( for /d /r %%r in (*) do (

View File

@ -9,10 +9,10 @@ echo nrm ls
echo nrm current echo nrm current
echo echo
echo "#<<< npm config get registry ==> $(npm config get registry)" echo "::*** npm config get registry ==> $(npm config get registry)"
echo echo
echo "#<<< npm config set registry \n [c] China, \n [w] World, [anything else] to quit" echo "::*** npm config set registry \n [c] China, \n [w] World, [anything else] to quit"
read -p "#>>> " TARGET read -p "***:: " TARGET
if [ "$TARGET" = 'c' ] if [ "$TARGET" = 'c' ]
then then
npm config set registry https://registry.npmmirror.com npm config set registry https://registry.npmmirror.com
@ -21,4 +21,4 @@ then
npm config set registry https://registry.npmjs.org npm config set registry https://registry.npmjs.org
fi fi
echo 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" ( @ if not "" == "%1" (
set PORT=%1 set PORT=%1
) else ( ) else (
echo #<<< Enter [port] to scan: echo ::*** Enter [port] to scan:
set /p PORT=">>> " set /p PORT=">>> "
echo; echo;
) )

View File

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

View File

@ -1,7 +1,7 @@
@REM 在 powershell 里,只要 ssr 打开全局模式,不需要设置 proxy 就可以。 @REM 在 powershell 里,只要 ssr 打开全局模式,不需要设置 proxy 就可以。
@REM 在 cmd 里,需要设置 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=">>> " set /p TODOMODE=">>> "
echo; echo;
if "s" == "%TODOMODE%" ( if "s" == "%TODOMODE%" (

View File

@ -1,12 +1,12 @@
#!/bin/bash #!/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 if [ -n "$1" ]; then
proxySwitch="$1" proxySwitch="$1"
else else
echo "#<<< 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change." echo "::*** 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change."
read -p "#>>> " proxySwitch read -p "***:: " proxySwitch
fi fi
# to reset port to empty, otherwise the second run of this script will not ask for port. # to reset port to empty, otherwise the second run of this script will not ask for port.
@ -14,10 +14,10 @@ PORT=
PORTDEFAULT=20170 PORTDEFAULT=20170
# function proxy() { # function proxy() {
if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then
echo "#<<< Proxy server running on [port number] or [leave blank] for default $PORTDEFAULT (20170 for v2ray2, or 7897 for clash verge)" echo "::*** Proxy server running on [port number] or [leave blank] for default $PORTDEFAULT (20170 for v2ray2, or 7897 for clash verge)"
while [ ! "$PORT" ] while [ ! "$PORT" ]
do do
read -p "#>>> " PORT read -p "***:: " PORT
if [ ! "$PORT" ] if [ ! "$PORT" ]
then then
PORT=$PORTDEFAULT PORT=$PORTDEFAULT

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
echo "#<<< rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit" echo "::*** rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit"
read -p "#>>> " ACTION_TYPE read -p "***:: " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ] if [ "$ACTION_TYPE" = 'i' ]
then then
sudo -v ; curl https://rclone.org/install.sh | sudo bash sudo -v ; curl https://rclone.org/install.sh | sudo bash
@ -16,30 +16,30 @@ then
fi fi
echo 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 echo
while [ ! "$TARGET_PATH" ] while [ ! "$TARGET_PATH" ]
do do
echo "#<<< to target [remote:path]" echo "::*** to target [remote:path]"
read -p "#>>> " TARGET_PATH read -p "***:: " TARGET_PATH
done 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
echo "excluding files and folders (folders must end with /)" echo "excluding files and folders (folders must end with /)"
read -p "#>>> " EXCLUDING; read -p "***:: " EXCLUDING;
echo echo
echo "with [number] files in parallel, default 4" echo "with [number] files in parallel, default 4"
read -p "#>>> " TRANSFERS; read -p "***:: " TRANSFERS;
if [ ! "$TRANSFERS" ]; then TRANSFERS=4; fi if [ ! "$TRANSFERS" ]; then TRANSFERS=4; fi
echo echo
echo "with [number] threads simultaneously, default 4"; echo "with [number] threads simultaneously, default 4";
read -p "#>>> " THREADS; read -p "***:: " THREADS;
if [ ! "$THREADS" ]; then THREADS=4; fi 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}" 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 echo
echo "Starting? [y] for yes, [anything else] for quit" echo "Starting? [y] for yes, [anything else] for quit"
read -p "#>>> " YES_OR_NOT read -p "***:: " YES_OR_NOT
echo echo
if [ "$YES_OR_NOT" = 'y' ] if [ "$YES_OR_NOT" = 'y' ]
then then

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ sudo apt update
sudo apt install -y seafile-cli 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'" 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 ] if [ ! $SETTINGS_FOLDER ]
then then
SETTINGS_FOLDER = ~/seafile-client SETTINGS_FOLDER = ~/seafile-client

View File

@ -7,7 +7,7 @@ set ROOTPATH=
set ROOTPATH=%1 set ROOTPATH=%1
) else ( ) else (
echo; 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=">>> " set /p ROOTPATH=">>> "
echo; echo;
if "" == "%ROOTPATH%" ( if "" == "%ROOTPATH%" (
@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" (
echo √√√ ROOTPATH = [[%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=">>> " set /p IGNOREPATH=">>> "
echo; echo;
if "" == "%IGNOREPATH%" ( if "" == "%IGNOREPATH%" (
@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" (
) )
pushd %ROOTPATH% pushd %ROOTPATH%
echo #<<< Starting from [[%CD%]] echo ::*** Starting from [[%CD%]]
echo; echo;
for /d /r %%r in (*) do ( for /d /r %%r in (*) do (

View File

@ -8,8 +8,8 @@ if [ -d "$1" ]
then then
ROOTPATH=$1 ROOTPATH=$1
else else
echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files" echo "::*** Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files"
read -p "#>>> " ROOTPATH read -p "***:: " ROOTPATH
if [ "$ROOTPATH" ] if [ "$ROOTPATH" ]
then then
ROOTPATH=$(realpath $ROOTPATH) ROOTPATH=$(realpath $ROOTPATH)
@ -26,8 +26,8 @@ else
fi fi
echo "" 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]]" 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 read -p "***:: " IGNOREPATH
if [ "$IGNOREPATH" ] if [ "$IGNOREPATH" ]
then then
if [ -d "$IGNOREPATH" ] if [ -d "$IGNOREPATH" ]
@ -46,8 +46,8 @@ else
fi fi
echo "" echo ""
echo "#<<< Enter [y] to start updating, or [anything else] to quit" echo "::*** Enter [y] to start updating, or [anything else] to quit"
read -p "#>>> " YESNO read -p "***:: " YESNO
if [ "$YESNO" != 'y' ] if [ "$YESNO" != 'y' ]
then then
exit exit

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/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 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 if [ -f seafile-ignore.local.txt ]; then cat seafile-ignore.local.txt >> seafile-ignore.txt; fi
echo echo

21
ssh.sh
View File

@ -36,12 +36,14 @@ if [ "$1" -ge 0 ] 2>/dev/null && [ "$1" -le ${#hosts[@]} ] 2>/dev/null
then then
selected_index=$1-1 selected_index=$1-1
else else
echo "Select a target to connect via SSH:" echo "Select a target to connect via SSH, or press 0 to exit:"
select target in "${labels[@]}" select target in "${labels[@]}"
do do
if [[ -n "$target" ]]; then if [[ -n "$target" ]]; then
selected_index=$REPLY-1 selected_index=$REPLY-1
break break
elif [ "$REPLY" = '0' ]; then
exit 0
else else
echo "Invalid selection. Try again." echo "Invalid selection. Try again."
fi fi
@ -61,13 +63,18 @@ then
port=22 port=22
fi fi
if [ "$password" != "" ] & [ "$(which sshpass)" != "" ] echo "::*** Coonecting to ${label}"
if [ "$password" != "null" ]
then then
echo "#<<< Coonecting to ${label} with password" if [ "$(which sshpass)" ]
echo "#>>> ssh -X -p $port $username@$host" then
sshpass -p $password ssh -X -p $port "$username@$host" $2 echo "::*** sshpass -p $password -X -p $port $username@$host"
sshpass -p $password ssh -X -p $port "$username@$host" $2
else
echo "::*** ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2
fi
else else
echo "#<<< Coonecting to ${label} with private key" echo "::*** ssh -X -p $port $username@$host"
echo "#>>> ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2 ssh -X -p $port "$username@$host" $2
fi fi

View File

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