diff --git a/debian-config.sh b/debian-config.sh index 6e982bb..51ca81c 100755 --- a/debian-config.sh +++ b/debian-config.sh @@ -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 or 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]: for autologin as [$NewUser] or 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]: for autologin as [$NewUser] or 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 diff --git a/docker-search-tags.sh b/docker-search-tags.sh new file mode 100644 index 0000000..b5c1eac --- /dev/null +++ b/docker-search-tags.sh @@ -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