Last active
August 12, 2020 17:15
OpenWrt system configuration including MidnightCommander, screen and ssmtp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opkg install bash bind-dig diffutils digitemp dstat file htop kmod-usb-serial-pl2303 less lftp lsof mc mtr nmap rsync screen ssmtp sudo tcpdump | |
#File highlighting in "mc" | |
mkdir -p /usr/lib/mc/extfs.d | |
touch /etc/mc/sfs.ini | |
wget --no-check-certificate https://raw.github.com/MidnightCommander/mc/master/misc/filehighlight.ini -O /etc/mc/filehighlight.ini | |
#Favorite "mc" settings | |
mkdir -p /etc/skel/.mc/ | |
chmod 700 /etc/skel/.mc | |
cat > /etc/skel/.mc/ini << EOF | |
[Midnight-Commander] | |
auto_save_setup=0 | |
drop_menus=1 | |
use_internal_edit=1 | |
confirm_exit=0 | |
[Layout] | |
menubar_visible=0 | |
message_visible=0 | |
EOF | |
cp -r /etc/skel/.mc /root/ | |
#Disable mouse + path "changer" | |
wget --no-check-certificate https://raw.github.com/MidnightCommander/mc/master/contrib/mc-wrapper.sh.in -O - | sed 's|@bindir@/mc|/usr/bin/mc --nomouse|' > /usr/bin/mc-wrapper.sh | |
chmod a+x /usr/bin/mc-wrapper.sh | |
echo "[ -x /usr/bin/mc-wrapper.sh ] && alias mc='. /usr/bin/mc-wrapper.sh'" >> /etc/profile | |
#Screen settings | |
cat >> /etc/screenrc << EOF | |
defscrollback 1000 | |
termcapinfo xterm ti@:te@ | |
hardstatus alwayslastline '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' | |
vbell off | |
EOF | |
#Prompt colors | |
sed -i 's/^export PS1.*/export PS1='\''\\\[\\033\[01;31m\\\]\\h\\\[\\033\[01;34m\\\] \\w #\\\[\\033\[00m\\\] '\''/' /etc/profile | |
#Make outgoing emails to reach the SMTP server: | |
sed -i "s/^mailhub=.*/mailhub=mail.upcmail.cz/;s/^rewriteDomain=.*/rewriteDomain=xvx.cz/;s/^hostname.*/hostname=`uci get system.@system[0].hostname`.`uci get dhcp.@dnsmasq[0].domain`/" /etc/ssmtp/ssmtp.conf | |
#Reboot email | |
sed -i '/^exit 0/i echo -e "Subject: Reboot `uci get system.@system[0].hostname`.`uci get dhcp.@dnsmasq[0].domain`\\n\\nOpenwrt rebooted: `date; uptime`\\n" | sendmail petr.ruzicka@gmail.com' /etc/rc.local | |
#Disable IPv6 in Unbound (and flooding the logs by ipv6 error messages) | |
uci add_list unbound.@unbound[-1].include_path=/etc/unbound/unbound_include | |
cat > /etc/unbound/unbound_include << EOF | |
server: | |
do-ip6: no | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment