This commit is contained in:
陆柯 2023-01-14 12:33:11 +08:00
parent b234cc5bbe
commit 393552e69d
8 changed files with 68 additions and 3 deletions

View File

@ -41,13 +41,13 @@ then
fi
echo
echo "=== Configure /etc/sudoers: includedir /etc/sudoers.d"
echo "=== Configure /etc/sudoers to includedir /etc/sudoers.d"
#sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers # allow all users in %sudo group to sudo without password
DebianVersionMain=`cat /etc/debian_version | sed -r 's/^([0-9]+)\..*$/\1/'`
if [ "$DebianVersionMain" == '10' ]
then
chmod o+w /etc/sudoers
## Debian 10 上,不存在 @includedir需要自己添加。而 Debian 11.1 上,已经存在 @includedir
## Debian 10 上,不存在 includedir需要自己添加。而 Debian 11.1 上,已经存在 @includedir
sed -i "s|#includedir /etc/sudoers.d|includedir /etc/sudoers.d|g" /etc/sudoers # allow users in /etc/sudoers.d/ folder to sudo
chmod o-w /etc/sudoers
fi

32
debian-ddinstall-debi.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
echo "Thanks https://github.com/bohanyang/debi"
echo
echo "=== Enter debian version [8,9,10,11,12] or [leave blank] for 11"
read -p ">>> " DEBIAN_VERSION
if [ -z "${DEBIAN_VERSION}" ]
then
DEBIAN_VERSION=11
fi
echo "=== Enter architecture [amd64, i386, arm64, armhf] or [leave blank] for amd64"
read -p ">>> " DEBIAN_ARCH
if [ -z "${DEBIAN_ARCH}" ]
then
DEBIAN_ARCH=amd64
fi
echo "=== Enter presets to download from [cdn, aws, china] or [leave blank] for cdn"
read -p ">>> " PRESET
if [ -z "${PRESET}" ]
then
PRESET=cdn
fi
sudo curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh
sudo chmod a+rx debi.sh
sudo ./debi.sh --version $DEBIAN_VERSION --architecture $DEBIAN_ARCH --user root --$PRESET # --architecture 可参略,默认为 amd64--password 可省略,则脚本启动后会问你要密码
echo "=== Shutdown now, wait for about 30 seconds, then try to ssh"
sudo shutdown -r now

2
debian-ddinstall.sh → debian-ddinstall-moeclub.sh Executable file → Normal file
View File

@ -1,3 +1,5 @@
#!/bin/bash
read -p "Enter root password (default to 'MoeClub.org') >> " ROOTPWD
read -p "Enter debian version to install (default to 11)>> " DEBIAN_VERSION

30
debian-show-version.sh Normal file
View File

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

View File

@ -29,6 +29,7 @@ elif [ -d $NIXHOME5 ]
then
NIXHOME=$NIXHOME5
else
echo ××× none of the testing path is valid.
echo "=== Enter [nixhome path] or leave [blank] to exit"
read -p ">>> " NIXHOME
echo ""
@ -101,7 +102,7 @@ then
# 由 root 指定新用户而创建的配置文件的 owner 是 root而不是新用户导致新用户无法读取该文件而密钥登录失败因此要重设 owner。
chown $TheUser:$TheUser $HomePath/.ssh
fi
if [ -e '$HomePath/.ssh/authorized_keys' ]
if [ -e "$HomePath/.ssh/authorized_keys" ]
then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date +%Y%m%dT%H%M%S)
fi

0
macos/config-mac.sh → mac-config.sh Executable file → Normal file
View File

0
macos/install-homebrew.sh → mac-install-homebrew.sh Executable file → Normal file
View File

0
macos/show-temperature.sh → mac-show-temperature.sh Executable file → Normal file
View File