This commit is contained in:
Luk 2025-03-15 11:50:34 +08:00
parent 99fe67201e
commit 673a685f04
6 changed files with 62 additions and 75 deletions

View File

@ -1,4 +1,4 @@
FROM debian:11.5
FROM debian:12.8
LABEL org.opencontainers.image.authors="luk"
RUN apt update && apt install curl -y

View File

@ -1,8 +1,9 @@
#!/bin/bash
## "curl -s https://git.tic.cc/npm/sysconfig/raw/branch/main/debian-setup.sh | bash"
echo "Usage: this.sh [NewUser]"
echo "Example: this.sh alice"
echo "curl -s https://git.faronear.org/npm/sysconfig/raw/branch/main/debian-setup.sh | bash"
if [ "$1" ]
then
@ -12,8 +13,8 @@ else
fi
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
#apt update
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
echo
@ -25,13 +26,13 @@ echo "::*** Git cloning to /faronear/sysconfig"
git config --global credential.helper cache
if [ ! -d "/faronear/sysconfig" ]
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/*
fi
echo
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 "::*** Change root password? [y] for yes, [anything else] for omit:"

View File

@ -1,7 +1,7 @@
echo "::*** Install formulaes and casks, enter [y] for Yes, [anything else] for No:"
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[@]}"
do
echo "--- brew install $APP"

View File

@ -42,32 +42,20 @@ if [ -d "$HomePath" ]; then
echo
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; do
if [ -e "$homescript" ] || [ -L "$homescript" ]; then
mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
fi
if [ "$CopyOrLinkScripts" == 'l' ]; then
echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
ln -s "$NIXHOME/$homescript" ./
done
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]] ..."
cp -r "$NIXHOME/$homescript" ./
done
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"
done
else
echo '--- Home scripts not changed.'
fi
done
echo
@ -86,13 +74,13 @@ if [ -d "$HomePath" ]; then
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
read -p "***:: " AuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]; then
if [ "$AuthorizedKeys" = 'l' ]; then
echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$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
elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ]; then
elif [ "$AuthorizedKeys" = 'a' ]; then
echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
cat "$NIXHOME/.ssh/authorized_keys" >> "$HomePath/.ssh/authorized_keys"
chmod 600 "$HomePath/.ssh/authorized_keys"

View File

@ -19,3 +19,10 @@ unset USERNAME
################################################################################
# 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 || :

View File

@ -16,9 +16,6 @@ then
. /etc/profile
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:
export CVS_RSH=ssh
@ -33,8 +30,8 @@ export CVS_RSH=ssh
# Define aliases:
alias rm='rm -i' # Think twice before deletion. Though troublesome but strongly recommended!
alias ssh='ssh -C -X' # Request X tunneling for SSH:
alias rm='rm -i' # Think twice before deletion. Though troublesome but strongly recommended.
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 cvs='cvs -z9' # Always use compression for CVS:
alias ps='ps -elf'
@ -48,6 +45,13 @@ alias su='su -'
alias npmc='npm --registry https://registry.npmmirror.com'
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 [ $(which aichat) ]
then
alias ai='aichat'
alias air='aichat -e'
alias aic='aichat -c'
alias aif='aichat --file'
fi
if [ "$(uname)" = "Darwin" ]
then
alias l='ls -lG'
@ -57,6 +61,8 @@ then
alias sedi='sed -i ""'
export HOMEBREW_NO_AUTO_UPDATE=true
export BASH_SILENCE_DEPRECATION_WARNING=1
promptPrefix='<'
promptSuffix='>'
else
alias l='ls -l --color=auto' # --time-style=long-iso --color=auto'
alias ll='ls -lA --color=auto'
@ -64,6 +70,8 @@ else
alias lll='ls -la --color=auto'
alias sedi='sed -i'
export TIME_STYLE='+%Y-%m-%d--%H:%M:%S'
promptPrefix='['
promptSuffix=']'
fi
#export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色
#export CLICOLOR='Yes' #是否输出颜色
@ -72,46 +80,32 @@ fi
# Set default file permission mask:
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 ####################
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
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)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
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`:
# $Style: text style
# - `00`: Default style
@ -132,21 +126,15 @@ fi
# - `5`: Magenta
# - `6`: Cyan
# - `7`: White
# others:
# \w shows absolute path, \W shows current folder.
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
PS1='<\t#\u@\h:\w> '
PS1='$promptPrefix\t#\u@\h($(uname)-$(uname -m)):\w$promptSuffix ' # \w shows absolute path, \W shows current folder.
fi
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 ####################
if [ "$(uname)" = "Darwin" ]
@ -199,3 +187,6 @@ fi
################################################################################
# End Of File: "~/.bashrc"
################################################################################
# Added by LM Studio CLI (lms)
export PATH="$PATH:/Users/luk/.cache/lm-studio/bin"