Fixed several issues and made some enhancement to make it more robust. now pushing to both gitea server and github.
This commit is contained in:
@@ -8,10 +8,16 @@ set -e
|
||||
echo "Configuring Chinese mirrors (Aliyun) for apt, pip, and npm..."
|
||||
|
||||
# Replace Ubuntu sources with Aliyun mirror
|
||||
# Ubuntu 24.04+ uses DEB822 format in sources.list.d/ubuntu.sources
|
||||
if [[ -f /etc/apt/sources.list.d/ubuntu.sources ]]; then
|
||||
sudo sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources
|
||||
sudo sed -i 's|http://security.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources
|
||||
echo "Updated Ubuntu apt sources to use Aliyun mirrors"
|
||||
echo "Updated Ubuntu apt sources (DEB822 format) to use Aliyun mirrors"
|
||||
# Ubuntu 22.04 and older use the traditional sources.list format
|
||||
elif [[ -f /etc/apt/sources.list ]]; then
|
||||
sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
|
||||
sudo sed -i 's|http://security.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
|
||||
echo "Updated Ubuntu apt sources (sources.list format) to use Aliyun mirrors"
|
||||
fi
|
||||
|
||||
# Configure npm registry to use Chinese mirror (npmmirror.com is the recommended mirror)
|
||||
|
||||
@@ -3,14 +3,19 @@
|
||||
# Setup home directory for the current user
|
||||
# Useful for attaching vscode with container
|
||||
|
||||
set -e
|
||||
|
||||
user_name=$(whoami)
|
||||
user_home="/home/$user_name"
|
||||
|
||||
# Root's home is /root, not /home/root
|
||||
if [[ "$user_name" == "root" ]]; then
|
||||
user_home="/root"
|
||||
else
|
||||
user_home="/home/$user_name"
|
||||
fi
|
||||
|
||||
echo "Setting up home directory for user: $user_name"
|
||||
sudo mkdir -p "$user_home"
|
||||
sudo chown -R "$(id -u):$(id -g)" "$user_home"
|
||||
cp -r /etc/skel/. "$user_home" 2>/dev/null || true
|
||||
# Use -n (no-clobber) to avoid overwriting existing dotfiles (e.g. from mounted volumes)
|
||||
cp -rn /etc/skel/. "$user_home" 2>/dev/null || true
|
||||
|
||||
echo "Home directory setup completed: $user_home"
|
||||
|
||||
Reference in New Issue
Block a user