u
This commit is contained in:
		
							parent
							
								
									99fe67201e
								
							
						
					
					
						commit
						673a685f04
					
				| @ -1,4 +1,4 @@ | |||||||
| FROM debian:11.5 | FROM debian:12.8 | ||||||
| LABEL org.opencontainers.image.authors="luk" | LABEL org.opencontainers.image.authors="luk" | ||||||
| 
 | 
 | ||||||
| RUN apt update && apt install curl -y | RUN apt update && apt install curl -y | ||||||
|  | |||||||
| @ -1,8 +1,9 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
|  | ## "curl -s https://git.tic.cc/npm/sysconfig/raw/branch/main/debian-setup.sh | bash" | ||||||
|  | 
 | ||||||
| echo "Usage: this.sh [NewUser]" | echo "Usage: this.sh [NewUser]" | ||||||
| echo "Example: this.sh alice" | echo "Example: this.sh alice" | ||||||
| echo "curl -s https://git.faronear.org/npm/sysconfig/raw/branch/main/debian-setup.sh | bash" |  | ||||||
| 
 | 
 | ||||||
| if [ "$1" ] | if [ "$1" ] | ||||||
| then | then | ||||||
| @ -12,8 +13,8 @@ else | |||||||
| 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 nano 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 | ||||||
| 
 | 
 | ||||||
| @ -25,13 +26,13 @@ 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 | ||||||
|   git clone https://git.faronear.org/npm/sysconfig /faronear/sysconfig |   git clone https://git.tic.cc/npm/sysconfig /faronear/sysconfig | ||||||
|   chmod -R 755 /faronear # 确保其他用户能够读取 /faronear/sysconfig/nixhome/* |   chmod -R 755 /faronear # 确保其他用户能够读取 /faronear/sysconfig/nixhome/* | ||||||
| fi | fi | ||||||
| echo | echo | ||||||
| 
 | 
 | ||||||
| echo "::*** Configure root home" | echo "::*** Configure root home" | ||||||
| source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root <<< 'l\nl\n' | 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:" | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| 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=(aichat 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" | ||||||
|  | |||||||
| @ -42,32 +42,20 @@ if [ -d "$HomePath" ]; then | |||||||
|   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' ]; then |   for homescript in $homescriptlist; do | ||||||
|     for homescript in $homescriptlist; do |     if [ -e "$homescript" ] || [ -L "$homescript" ]; then | ||||||
|       if [ -e "$homescript" ] || [ -L "$homescript" ]; then |       mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" | ||||||
|         mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" |     fi | ||||||
|       fi |     if [ "$CopyOrLinkScripts" == 'l' ]; then | ||||||
|       echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." |       echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." | ||||||
|       ln -s "$NIXHOME/$homescript" ./ |       ln -s "$NIXHOME/$homescript" ./ | ||||||
|     done |     elif [ "$CopyOrLinkScripts" == 'c' ]; then | ||||||
|   elif [ "$CopyOrLinkScripts" == 'c' ]; then |  | ||||||
|     for homescript in $homescriptlist; do |  | ||||||
|       if [ -e "$homescript" ] || [ -L "$homescript" ]; then |  | ||||||
|         mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" |  | ||||||
|       fi |  | ||||||
|       echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." |       echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." | ||||||
|       cp -r "$NIXHOME/$homescript" ./ |       cp -r "$NIXHOME/$homescript" ./ | ||||||
|     done |     elif [ "$CopyOrLinkScripts" == 'g' ]; then | ||||||
|   elif [ "$CopyOrLinkScripts" == 'g' ]; then |  | ||||||
|     for homescript in $homescriptlist; do |  | ||||||
|       if [ -e "$homescript" ] || [ -L "$homescript" ]; then |  | ||||||
|         mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" |  | ||||||
|       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 |     fi | ||||||
|   else |   done   | ||||||
|     echo '--- Home scripts not changed.' |  | ||||||
|   fi |  | ||||||
| 
 | 
 | ||||||
|   echo |   echo | ||||||
| 
 | 
 | ||||||
| @ -86,13 +74,13 @@ if [ -d "$HomePath" ]; then | |||||||
|     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 "***:: " AuthorizedKeys | ||||||
| 
 | 
 | ||||||
|     if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]; then |     if [ "$AuthorizedKeys" = 'l' ]; 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' ]; then |     elif [ "$AuthorizedKeys" = 'a' ]; 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" | ||||||
|  | |||||||
| @ -19,3 +19,10 @@ unset USERNAME | |||||||
| ################################################################################ | ################################################################################ | ||||||
| # End Of File: "~/.bash_profile" | # End Of File: "~/.bash_profile" | ||||||
| ################################################################################ | ################################################################################ | ||||||
|  | 
 | ||||||
|  | # Added by LM Studio CLI (lms) | ||||||
|  | export PATH="$PATH:/Users/luk/.cache/lm-studio/bin" | ||||||
|  | 
 | ||||||
|  | # Added by OrbStack: command-line tools and integration | ||||||
|  | # This won't be added again if you remove it. | ||||||
|  | source ~/.orbstack/shell/init.bash 2>/dev/null || : | ||||||
|  | |||||||
| @ -16,9 +16,6 @@ then | |||||||
|   . /etc/profile |   . /etc/profile | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Define primary prompt (default is '$'): |  | ||||||
| export PS1='<\u@\h::\w> ' # \w shows absolute path, \W shows current folder. |  | ||||||
| 
 |  | ||||||
| # Always use ssh to connect to CVS repositories: | # Always use ssh to connect to CVS repositories: | ||||||
| export CVS_RSH=ssh | export CVS_RSH=ssh | ||||||
| 
 | 
 | ||||||
| @ -33,8 +30,8 @@ export CVS_RSH=ssh | |||||||
| 
 | 
 | ||||||
| # Define aliases: | # Define aliases: | ||||||
| 
 | 
 | ||||||
| alias rm='rm -i' # Think twice before deletion. Though troublesome but strongly recommended! | alias rm='rm -i' # Think twice before deletion. Though troublesome but strongly recommended. | ||||||
| alias ssh='ssh -C -X' # Request X tunneling for SSH: | alias sshx='ssh -C -X' # Request X tunneling for SSH: | ||||||
| alias sshtrust='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' # Do not verify Host Key change: | alias sshtrust='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' # Do not verify Host Key change: | ||||||
| alias cvs='cvs -z9' # Always use compression for CVS: | alias cvs='cvs -z9' # Always use compression for CVS: | ||||||
| alias ps='ps -elf' | alias ps='ps -elf' | ||||||
| @ -48,6 +45,13 @@ alias su='su -' | |||||||
| alias npmc='npm --registry https://registry.npmmirror.com' | alias npmc='npm --registry https://registry.npmmirror.com' | ||||||
| alias npmr='npm -s 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"' | alias curlw='curl -sSL -o /dev/null -w "%{http_code} | %{time_total} s | %{size_download} bytes | %{url_effective}\n"' | ||||||
|  | if [ $(which aichat) ] | ||||||
|  | then | ||||||
|  |   alias ai='aichat' | ||||||
|  |   alias air='aichat -e' | ||||||
|  |   alias aic='aichat -c' | ||||||
|  |   alias aif='aichat --file' | ||||||
|  | fi | ||||||
| if [ "$(uname)" = "Darwin" ] | if [ "$(uname)" = "Darwin" ] | ||||||
| then | then | ||||||
|   alias l='ls -lG' |   alias l='ls -lG' | ||||||
| @ -57,6 +61,8 @@ then | |||||||
|   alias sedi='sed -i ""' |   alias sedi='sed -i ""' | ||||||
|   export HOMEBREW_NO_AUTO_UPDATE=true |   export HOMEBREW_NO_AUTO_UPDATE=true | ||||||
|   export BASH_SILENCE_DEPRECATION_WARNING=1 |   export BASH_SILENCE_DEPRECATION_WARNING=1 | ||||||
|  |   promptPrefix='<' | ||||||
|  |   promptSuffix='>' | ||||||
| else | else | ||||||
|   alias l='ls -l --color=auto' # --time-style=long-iso --color=auto' |   alias l='ls -l --color=auto' # --time-style=long-iso --color=auto' | ||||||
|   alias ll='ls -lA --color=auto' |   alias ll='ls -lA --color=auto' | ||||||
| @ -64,6 +70,8 @@ else | |||||||
|   alias lll='ls -la --color=auto' |   alias lll='ls -la --color=auto' | ||||||
|   alias sedi='sed -i' |   alias sedi='sed -i' | ||||||
|   export TIME_STYLE='+%Y-%m-%d--%H:%M:%S'  |   export TIME_STYLE='+%Y-%m-%d--%H:%M:%S'  | ||||||
|  |   promptPrefix='[' | ||||||
|  |   promptSuffix=']' | ||||||
| fi | fi | ||||||
| #export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色 | #export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色 | ||||||
| #export CLICOLOR='Yes'            #是否输出颜色 | #export CLICOLOR='Yes'            #是否输出颜色 | ||||||
| @ -72,46 +80,32 @@ fi | |||||||
| # Set default file permission mask: | # Set default file permission mask: | ||||||
| umask 022 # rwxr-xr-x | umask 022 # rwxr-xr-x | ||||||
| 
 | 
 | ||||||
| # If this is an xterm set the title to user@host:dir |  | ||||||
| # $USERNAME and $USER are both empty during execution of .bashrc.  |  | ||||||
| # PROMPT_COMMAND is expanded only when used. |  | ||||||
| case "$TERM" in |  | ||||||
|     xterm*|rxvt*) |  | ||||||
| 	PROMPT_COMMAND='echo -ne "\033]0;<${USER}@${HOSTNAME}:${PWD}>B\007"' |  | ||||||
| 	;; |  | ||||||
|     dumb*) |  | ||||||
| 	;; |  | ||||||
|     *) |  | ||||||
| 	;; |  | ||||||
| esac |  | ||||||
| 
 |  | ||||||
| ############## following settings copied from amazon's debian #################### | ############## following settings copied from amazon's debian #################### | ||||||
| # set variable identifying the chroot you work in (used in the prompt below) | # set variable identifying the chroot you work in (used in the prompt below) | ||||||
| if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | ||||||
|     debian_chroot=$(cat /etc/debian_chroot) |     debian_chroot=$(cat /etc/debian_chroot) | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | ## uncomment for a colored prompt, if the terminal has the capability; turned | ||||||
|  | ## off by default to not distract the user: the focus in a terminal window | ||||||
|  | ## should be on the output of commands, not on the prompt | ||||||
|  | # force_color_prompt=yes | ||||||
|  | # if [ -n "$force_color_prompt" ]; then | ||||||
|  | #     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | ||||||
|  | # 	# We have color support; assume it's compliant with Ecma-48 | ||||||
|  | # 	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | ||||||
|  | # 	# a case would tend to support setf rather than setaf.) | ||||||
|  | # 	color_prompt=yes | ||||||
|  | #     else | ||||||
|  | # 	color_prompt= | ||||||
|  | #     fi | ||||||
|  | # fi | ||||||
|  | 
 | ||||||
| # set a fancy prompt (non-color, unless we know we "want" color) | # set a fancy prompt (non-color, unless we know we "want" color) | ||||||
| case "$TERM" in | case "$TERM" in | ||||||
|     xterm-color|*-256color) color_prompt=yes;; |     xterm-color|*-256color) color_prompt=yes;; | ||||||
| esac | esac | ||||||
| 
 | 
 | ||||||
| # uncomment for a colored prompt, if the terminal has the capability; turned |  | ||||||
| # off by default to not distract the user: the focus in a terminal window |  | ||||||
| # should be on the output of commands, not on the prompt |  | ||||||
| #force_color_prompt=yes |  | ||||||
| 
 |  | ||||||
| if [ -n "$force_color_prompt" ]; then |  | ||||||
|     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |  | ||||||
| 	# We have color support; assume it's compliant with Ecma-48 |  | ||||||
| 	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such |  | ||||||
| 	# a case would tend to support setf rather than setaf.) |  | ||||||
| 	color_prompt=yes |  | ||||||
|     else |  | ||||||
| 	color_prompt= |  | ||||||
|     fi |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| # color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style;$Type$Color`: | # color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style;$Type$Color`: | ||||||
| # $Style: text style | # $Style: text style | ||||||
| # - `00`: Default style | # - `00`: Default style | ||||||
| @ -132,21 +126,15 @@ fi | |||||||
| # - `5`: Magenta | # - `5`: Magenta | ||||||
| # - `6`: Cyan | # - `6`: Cyan | ||||||
| # - `7`: White | # - `7`: White | ||||||
|  | # others: | ||||||
|  | # \w shows absolute path, \W shows current folder. | ||||||
| if [ "$color_prompt" = yes ]; then | if [ "$color_prompt" = yes ]; then | ||||||
|     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\]> ' |     PS1='$promptPrefix\[\033[01;42m\]\t\[\033[00m\]#\[\033[01;45m\]\u\[\033[00m\]@\[\033[01;41m\]\h|$(uname)|$(uname -m)\[\033[00m\]::\[\033[01;44m\]\w\[\033[00m\]$promptSuffix ' | ||||||
| else | else | ||||||
|     PS1='<\t#\u@\h:\w> ' |     PS1='$promptPrefix\t#\u@\h($(uname)-$(uname -m)):\w$promptSuffix ' # \w shows absolute path, \W shows current folder. | ||||||
| fi | fi | ||||||
| unset color_prompt force_color_prompt | unset color_prompt force_color_prompt | ||||||
| 
 | 
 | ||||||
| # If this is an xterm set the title to user@host:dir |  | ||||||
| case "$TERM" in |  | ||||||
| xterm*|rxvt*) |  | ||||||
|     PS1="\[\e]0;\u@\h::\w\a\]$PS1" |  | ||||||
|     ;; |  | ||||||
| *) |  | ||||||
|     ;; |  | ||||||
| esac |  | ||||||
| ############## above settings copied from amazon's debian #################### | ############## above settings copied from amazon's debian #################### | ||||||
| 
 | 
 | ||||||
| if [ "$(uname)" = "Darwin" ] | if [ "$(uname)" = "Darwin" ] | ||||||
| @ -199,3 +187,6 @@ fi | |||||||
| ################################################################################ | ################################################################################ | ||||||
| # End Of File: "~/.bashrc" | # End Of File: "~/.bashrc" | ||||||
| ################################################################################ | ################################################################################ | ||||||
|  | 
 | ||||||
|  | # Added by LM Studio CLI (lms) | ||||||
|  | export PATH="$PATH:/Users/luk/.cache/lm-studio/bin" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user