Fixes and additions.

This commit is contained in:
Cyteen May 2020-02-12 14:10:01 +00:00
parent 720603801a
commit 43bfd704ba
5 changed files with 221 additions and 0 deletions

89
010_unattended-upgrades.sh Executable file
View File

@ -0,0 +1,89 @@
#!/usr/bin/env bash
#apt-get install -y unattended-upgrades apt-listchanges
# /etc/apt/apt.conf.d/50unattended-upgrades
CONF_DIR=/etc/apt/apt.conf.d
#CONF_DIR=/tmp
# send report email
sed -i 's|^//Unattended-Upgrade::Mail "root@localhost";|Unattended-Upgrade::Mail "root@localhost";|' ${CONF_DIR}/50unattended-upgrades
# email only on errors
#sed -i 's|^//Unattended-Upgrade::MailOnlyOnError "true";|Unattended-Upgrade::MailOnlyOnError "true";|' ${CONF_DIR}/50unattended-upgrades
# autoremove unused deps
sed -i 's|^//Unattended-Upgrade::Remove-Unused-Dependencies "false";|Unattended-Upgrade::Remove-Unused-Dependencies "true";|' ${CONF_DIR}/50unattended-upgrades
# reboot without confirmation if the file /var/run/reboot-required is present
sed -i 's|^//Unattended-Upgrade::Automatic-Reboot "false";|Unattended-Upgrade::Automatic-Reboot "false";|' ${CONF_DIR}/50unattended-upgrades
#sed -i '|^Unattended-Upgrade::Automatic-Reboot "true";| s|.*|&\nUnattended-Upgrade::Automatic-Reboot-Time "00:00";|' ${CONF_DIR}/50unattended-upgrades
# limit bandwidth for apt
sed -i 's|^//Acquire::http::Dl-Limit "70";|Acquire::http::Dl-Limit "70";|' ${CONF_DIR}/50unattended-upgrades
# stop upgrades on battery power
sed -i 's|^Unattended-Upgrade::OnlyOnACPower "false";|Unattended-Upgrade::OnlyOnACPower "false";|' ${CONF_DIR}/50unattended-upgrades
# Only upgrade on unmetered connection
sed -i 's|^Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";|Unattended-Upgrade::Skip-Updates-On-Metered-Connections "true";|' ${CONF_DIR}/50unattended-upgrades
## Automatically upgrade packages from these (origin, archive) pairs
# Unattended-Upgrade::Allowed-Origins
# "Ubuntu lucid-security";
#};
## List of packages to not update
#Unattended-Upgrade::Package-Blacklist {
#// "vim";
#// "libc6";
#// "libc6-dev";
#// "libc6-i686";
# "ant-doc";
#};
cat > ${CONF_DIR}/99unattended-upgrades <<'EOF'
clear Unattended-Upgrade::Allowed-Origins;
// Only allow security origin
Unattended-Upgrade::Allowed-Origins {
// "${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
};
clear Unattended-Upgrade::Package-Blacklist;
Unattended-Upgrade::Package-Blacklist {
"linux-headers*";
"linux-image*";
"linux-generic*";
"linux-modules*";
"spl-dkms";
"zfs-dkms"
};
EOF
## Enable
## ${CONF_DIR}/20auto-upgrades
# APT::Periodic::Update-Package-Lists "1";
# APT::Periodic::Unattended-Upgrade "1";
## create this file with only the two lines above using the following:
# echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections
# dpkg-reconfigure -f noninteractive unattended-upgrades
cat > ${CONF_DIR}/20auto-upgrades <<'EOF'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "3";
EOF
## Disable
## ${CONF_DIR}/20auto-upgrades-disabled
# APT::Periodic::Update-Package-Lists "0";
# APT::Periodic::Unattended-Upgrade "0";
## create this file with only the two lines above using the following:
# echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean false | debconf-set-selections
# dpkg-reconfigure -f noninteractive unattended-upgrades
# Test configuration with:
unattended-upgrades -d

34
020_dissenter-browser.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
apt-get install -y fonts-liberation libappindicator3-1 libdbusmenu-glib4 libdbusmenu-gtk3-4 libindicator3-7
apt-get install -y dpkg-dev fakeroot lintian apt-utils deb-pkg-tools
# FIXME: change the xpaths to relative paths to the labe
#!/bin/env python3
URL = 'https://dissenter.com/#download'
VERSION = '//*[@id="download"]/div[2]/div/span[2]/text()' # ['v0.70.122']
BUTTON_LABEL = '//*[@id="download"]/div[2]/div/a[2]/text()' # ['Download deb']
LINK = '//*[@id="download"]/div[2]/div/a[2]/@href' # ['https://apps.gab.com/application/5d3f93a29dd49a5b1d9fc27f/resource/5dbdab9853c1056bd98c3525']
import requests
import lxml.html
from lxml import etree
import subprocess
response = requests.get(URL)
print(response.url)
APP_VERSION = tree.xpath(VERSION)
APP_BUTTON_LABEL = tree.xpath(BUTTON_LABEL)
APP_LINK = tree.xpath(LINK)
subprocess.call("(TEMP_DEB="$(mktemp)"; wget -O "${TEMP_DEB}" "${APP_LINK}"; rm -rf "${TEMP_DEB}")", shell=True)
#subprocess.run(['useradd', '-m', '-g {0}'.format(_primarygroup), '-G {0}'.format(_secondarygroup), '-u {0}'.format(_userid)], capture_output=True)
#---------------------------------------------------
TEMP_DEB="$(mktemp)"
wget -O "$TEMP_DEB" "${LINK}"
sudo dpkg -i "${TEMP_DEB}"
rm -f "${TEMP_DEB}"
apt-get -f install

50
020_mutt.sh Executable file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
gpgme
mu
# https://neomutt.org/guide/
apt-get install -y neomutt urlscan w3m w3m-img ripmime isync khard msmtp vdirsyncer notmuch-mutt pass mailsync libnotify-bin lynx urlview
mkdir ~/Mail
NEOMUTTCONF=~/.config/mutt
COLORSCHEMES=${NEOMUTTCONF}/colorschemes
FONTS=${NEOMUTTCONF}/fonts
mkdir -p ${COLORSCHEMES}
MUTT_CONF=~/.mutt
mkdir -p ${MUTT_CONF}
cat > ${MUTT_CONF}/muttrc <<'EOF'
EOF
git clone https://github.com/sheoak/neomutt-powerline-nerdfonts.git ${NEOMUTTCONF}/powerline
wget -c -P ${COLORSCHEMES} https://raw.githubusercontent.com/neomutt/neomutt/master/contrib/colorschemes/neonwolf-256.neomuttrc
wget -c -P ${COLORSCHEMES} https://raw.githubusercontent.com/neomutt/neomutt/master/contrib/colorschemes/zenburn.neomuttrc
wget -c -P ${COLORSCHEMES} https://raw.githubusercontent.com/neomutt/neomutt/master/contrib/colorschemes/vombatidae.neomuttrc
wget -c -P ${COLORSCHEMES} https://raw.githubusercontent.com/neomutt/neomutt/master/contrib/colorschemes/solarized-dark-256.neomuttrc
# edit neomutt configuration:
cat > ~/.config/neomutt/neomuttrc <<"EOF"
source colorschemes/vombatidae.neomuttrc
# for solarized:
# you must load solarized 16 colors theme BEFORE this
# you terminal 16 colors must be set to solarized theme
source powerline/powerline.neomuttrc
# for gruvbox:
# you must load gruvbox theme BEFORE this
# you terminal 16 colors must be set to gruvbox theme
#source powerline/colors/gruvbox-powerline.neomuttrc
#source powerline/powerline.neomuttrc
EOF
#gpg --full-gen-key

29
020_slim.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Set enlightenment as the default session.
apt-get install -y slim
## /etc/slim.conf
# login_cmd exec /bin/bash -login /etc/X11/Xsession %session
# sessiondir /usr/share/xsessions/ # contains enlightenment.desktop:Exec=/usr/bin/enlightenment and xfce.desktop:Exec=startxfce4
# default_user devuan
# auto_login yes
USER_NAME=default
sed -i "s|^login_cmd.*|login_cmd exec /bin/sh - ~/.xinitrc \%session|" /etc/slim.conf && \
sed -i "/^#.*auto_login/ s/^#//" /etc/slim.conf && \
sed -i "s/^default_user.*/default_user\ ${USER_NAME}/" /etc/slim.conf && \
sed -i "/^# default_user/ s/^#//" /etc/slim.conf
cat > ~/.xinitrc <<'EOF'
DEFAULT_SESSION=enlightenment_start
case $session in
enlightenment ) exec enlightenment_start ;;
xfce|xfce4 ) exec startxfce4 ;;
# No known session, try to run it as command
*) exec $DEFAULT_SESSION ;;
esac
EOF

19
020_torproject.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
AVAILABLE=/etc/apt/sources.list-available
ACTIVE=/etc/apt/sources.list.d
apt-get install -y apt-transport-https
bash -c "cat > ${AVAILABLE}/torproject.list" <<EOF
# wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
# gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
deb https://deb.torproject.org/torproject.org buster main
deb-src https://deb.torproject.org/torproject.org buster main
EOF
ln -sf "${AVAILABLE}"/torproject.list "${ACTIVE}"/torproject.list
wget -q -O- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | apt-key add -
apt update
apt install -y tor deb.torproject.org-keyring