Enable zsh by default

merge-requests/16/head
Raphaël Hertzog 5 years ago
parent cfd250bcab
commit 7ec405792b
No known key found for this signature in database
GPG Key ID: 03881DABEBC29AB9

@ -1,4 +0,0 @@
#!/bin/sh
# Set "kali" as password for the user kali
usermod -p 'AqLUsDitNnTsw' kali

@ -0,0 +1,19 @@
#!/bin/sh
configure_zsh() {
# Stop if zsh is not present
if [ ! -x /usr/bin/zsh ]; then
return
fi
# Stop if user has opted out of zsh
if echo "${LIVE_CONFIG_CMDLINE}" | grep -qs 'nozsh'; then
return
fi
chsh --shell /usr/bin/zsh kali
}
# Set "kali" as password for the user kali
usermod -p 'AqLUsDitNnTsw' kali
# Change default shell to zsh
configure_zsh

@ -1,17 +1,41 @@
#!/bin/sh
if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"
exit 0
fi
configure_sources_list() {
if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"
return
fi
echo "INFO: sources.list is empty, setting up a default one for Kali"
echo "INFO: sources.list is empty, setting up a default one for Kali"
cat >/etc/apt/sources.list <<END
cat >/etc/apt/sources.list <<END
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free
END
apt-get update
apt-get update
}
configure_zsh() {
if grep -q 'nozsh' /proc/cmdline; then
echo "INFO: user opted out of zsh by default"
return
fi
if [ ! -x /usr/bin/zsh ]; then
echo "INFO: /usr/bin/zsh is not available"
return
fi
for user in $(cd /home && ls); do
if ! getent passwd $user >/dev/null; then
echo "WARNING: user '$user' is invalid but /home/$user exists"
continue
fi
echo "INFO: changing default shell of user '$user' to zsh"
chsh --shell /usr/bin/zsh $user
done
}
configure_sources_list
configure_zsh

Loading…
Cancel
Save