This commit is contained in:
陆柯 2022-12-06 09:26:20 +08:00
parent 20aae37be5
commit fca8be8855
2 changed files with 66 additions and 16 deletions

View File

@ -53,11 +53,13 @@ then
fi
echo
echo "=== Disallow root login: #PermitRootLogin yes"
# emacs /etc/ssh/sshd_config
sed -i "s|^PermitRootLogin yes|#PermitRootLogin yes|g" /etc/ssh/sshd_config
service sshd restart
echo
if [ -e /etc/ssh/sshd_config ]
then
echo "=== Disallow root login: #PermitRootLogin yes"
sed -i "s|^PermitRootLogin yes|#PermitRootLogin yes|g" /etc/ssh/sshd_config
service sshd restart
echo
fi
echo "=== Set <hostname> or <leave blank> for no change"
read -p ">>> " NewHostname
@ -100,18 +102,18 @@ read -p ">>> " AddNewUser
if [ "$AddNewUser" == 'y' ]
then
source /faronear/fon/sysconfig/debian-add-user.sh $NewUser
fi
echo
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: <y> for autologin as [$NewUser] or <anything else> for no change:"
read -p ">>> " XfceAutologin
if [ "$XfceAutologin" == "y" ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "--- Successfully configured autologin as $NewUser"
else
echo '--- Nothing changed.'
echo
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: <y> for autologin as [$NewUser] or <anything else> for no change:"
read -p ">>> " XfceAutologin
if [ "$XfceAutologin" == "y" ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "--- Successfully configured autologin as $NewUser"
else
echo '--- Nothing changed.'
fi
fi
echo

48
docker-search-tags.sh Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
echo "Usage:"
echo ' "this-script.sh [imageName]" to search library/[imageName]'
echo ' "this-script.sh [imageName] [ownerName]" to search [ownerName]/[imageName]'
echo ' "this.script.sh" to interactive enter [ownerName] and [imageName] to search'
echo
IMAGE=$1
while [ ! "$IMAGE" ]
do
echo "=== Enter [image name]:"
read -p ">>> " IMAGE
echo
done
OWNER=$2
if [ ! "$OWNER" ]
then
if [ "$1" ]
then
OWNER="library"
else
echo "=== Enter [owner name] or [empty] for default 'library':"
read -p ">>> " OWNER
if [ ! "$OWNER" ]
then
OWNER="library"
fi
fi
fi
echo
echo "=== Searching $OWNER/$IMAGE ......"
echo
page_size=100
page_index=0
while true; do
page_index=$((page_index+1))
results=`curl -L -s "https://registry.hub.docker.com/v2/repositories/$OWNER/$IMAGE/tags?page=$page_index&page_size=$page_size" | jq -r 'select(.results != null) | .results[]["name"]'`
if [ $? != 0 ] || [ "$results" == "" ]; then
break
fi
echo "$results"
done
echo