|
|
@ -0,0 +1,61 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
## FUNCTIONS |
|
|
|
|
|
|
|
function runVoid(){ |
|
|
|
local COMMAND="$@" |
|
|
|
bash -c "${COMMAND}" >/dev/null 2>&1 |
|
|
|
return $? |
|
|
|
} |
|
|
|
|
|
|
|
## MAIN |
|
|
|
|
|
|
|
[ `id -u` -eq 0 ] && echo 'normal user required' && exit -1 |
|
|
|
|
|
|
|
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! |
|
|
|
|
|
|
|
## openssh-server |
|
|
|
PGKNAME='openssh-server' |
|
|
|
runVoid dpkg-query --status $PGKNAME |
|
|
|
if [ $? -ne 0 ] ; then |
|
|
|
set -e |
|
|
|
pkexec apt install $PGKNAME |
|
|
|
pkexec /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config |
|
|
|
pkexec /opt/debian-bash/tools/append_or_replace "^#\?PasswordAuthentication.*$" "PasswordAuthentication no" /etc/ssh/sshd_config |
|
|
|
pkexec /opt/debian-bash/tools/append_or_replace "^#\?AllowUsers.*$" "AllowUsers $ALLOWED_USERS" /etc/ssh/sshd_config |
|
|
|
pkexec systemctl restart sshd |
|
|
|
set +e |
|
|
|
else |
|
|
|
echo "${PGKNAME} already installed!" |
|
|
|
fi |
|
|
|
|
|
|
|
## firefox latest |
|
|
|
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]];then |
|
|
|
set -e |
|
|
|
cd /tmp |
|
|
|
wget `curl 'https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US' | cut -d '"' -f2` -O firefox-latest.tar.bz2 |
|
|
|
pkexec mkdir /opt/firefox -p |
|
|
|
pkexec chown $USER /opt/firefox |
|
|
|
tar -xjf firefox-latest.tar.bz2 -C /opt |
|
|
|
cat <<EOF | pkexec tee -a /usr/share/applications/firefox-stable.desktop |
|
|
|
[Desktop Entry] |
|
|
|
Name=Firefox Stable |
|
|
|
Comment=Web Browser |
|
|
|
Exec=/opt/firefox/firefox %u |
|
|
|
Terminal=false |
|
|
|
Type=Application |
|
|
|
Icon=/opt/firefox/browser/chrome/icons/default/default128.png |
|
|
|
Categories=Network;WebBrowser; |
|
|
|
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; |
|
|
|
StartupNotify=true |
|
|
|
StartupWMClass=Firefox |
|
|
|
EOF |
|
|
|
pkexec ln -s /opt/firefox/firefox /usr/local/bin/firefox |
|
|
|
pkexec update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 && sudo update-alternatives --set x-www-browser /opt/firefox/firefox |
|
|
|
pkexec apt remove firefox-esr |
|
|
|
set +e |
|
|
|
else |
|
|
|
echo "firefox latest already installed!" |
|
|
|
fi |
|
|
|
|
|
|
|
|