Skip to content

Instantly share code, notes, and snippets.

@TheRinger
Created September 8, 2019 23:05
Show Gist options
  • Save TheRinger/c0bb29f007795abed4d0f26df5358032 to your computer and use it in GitHub Desktop.
Save TheRinger/c0bb29f007795abed4d0f26df5358032 to your computer and use it in GitHub Desktop.
My Apporach on How to Keep Slackware Upgraded
#!/bin/sh
# File : mirror
# Description : Slackware repository mirroring.
# Author : Deny Dias <http://mexapi.macpress.com.br>
# License : GPLv3
# Last Modified : 2019-08-04
# Clean up and preserve sensitive packages
echo "[BEGIN] Cleaning up and preserving sensitive packages... Preserving:"
echo " - glibc-solibs, icu4c, boost, harfbuzz, libevent"
echo " - kernel-{firmware,generic,headers,modules,source}"
find /volume1/mirrors/slackware64-preserve/ -type f -mtime +180 -delete
cp -afv \
/volume1/mirrors/slackware64-current/slackware64/a/glibc-solibs* \
/volume1/mirrors/slackware64-current/slackware64/l/icu4c* \
/volume1/mirrors/slackware64-current/slackware64/l/boost* \
/volume1/mirrors/slackware64-current/slackware64/l/harfbuzz* \
/volume1/mirrors/slackware64-current/slackware64/l/libevent* \
/volume1/mirrors/slackware64-current/slackware64/a/kernel-firmware* \
/volume1/mirrors/slackware64-current/slackware64/a/kernel-generic* \
/volume1/mirrors/slackware64-current/slackware64/d/kernel-headers* \
/volume1/mirrors/slackware64-current/slackware64/a/kernel-modules* \
/volume1/mirrors/slackware64-current/slackware64/k/kernel-source* \
/volume1/mirrors/slackware64-preserve/
echo "[FINISHED] Cleaning up and preserving sensitive packages."
echo
# Mirror: Slackware64 -current, selected l10n, exclude XFCE
# Source: rsync://slackbuilds.org/mirror/slackware/slackware64-current/
echo "[BEGIN] Slackware64 -current, selected l10n, exclude XFCE..."
rsync -vazP --delete-after --partial-dir=.partial-dir \
--exclude=pasture --exclude=source --exclude=testing --exclude=xfce \
--delete-excluded \
--filter='+ */' \
--filter='+ **/aspell-*' \
--filter='+ **/aspell-pt_BR*' \
--filter='- **/aspell*' \
--filter='+ **/calligra-l10n-pt_BR*' \
--filter='- **/calligra-l10n*' \
--filter='+ **/kde-l10n-pt_BR*' \
--filter='- **/kde-l10n*' \
rsync://slackbuilds.org/slackware/slackware64-current/ \
/volume1/mirrors/slackware64-current/
echo "[FINISHED] Slackware64 -current, selected l10n, exclude XFCE."
echo
# Mirror: AlienBOB's latest Ktown
# Source: rsync://bear.alienbase.nl/mirrors/alien-kde/current/latest/x86_64/
echo "[BEGIN] AlienBOB's latest Ktown..."
rsync -vazP --no-motd --delete-after --partial-dir=.partial-dir \
--delete-excluded \
rsync://bear.alienbase.nl/mirrors/alien-kde/current/latest/x86_64/ \
/volume1/mirrors/alienbob/ktown/latest/
echo "[FINISHED] AlienBOB's latest Ktown."
echo
# Fix permissions
echo "Cleaning up and setting permissions..."
rm -rf /volume1/mirrors/slackware64-current/extra/flashplayer-plugin \
/volume1/mirrors/slackware64-current/extra/java
chown -R deny:users /volume1/mirrors/alienbob /volume1/mirrors/slack*
echo "All set."
echo
#!/bin/sh
# File : minskyup
# Description : Install/upgrade stuff in my main machine, minsky.
# Author : Deny Dias <http://mexapi.macpress.com.br>
# License : GPLv3
# Last Modified : 2019-09-05
# System info
upinfo () {
neofetch && inxi -v2 -A
}
# Update NAS mirrors
upmirror () {
sudo ssh galileo "/volume1/homes/deny/opt/bin/mirror"
}
# Upgrade Slackware
upos () {
# Check for root
if [[ $EUID -ne 0 ]]; then
echo "Slackware upgrades are for root only."
exit 1
fi
# Check for console (no X)
if [ "$1" != "--force" ]; then
if xhost >& /dev/null; then
echo "Oops! It's not wise to upgrade Slackware inside an X session."
echo "Kill X with 'sudo /sbin/init 3' and try again (or try --force.)"
exit 2
fi
else
echo "It's not wise to upgrade Slackware inside an X session, but --force was used. Continue anyway?"
read -p "Press [CTRL-C] to abort or [Enter] to continue..."
fi
set -e
MIRROR="/media/nas/mirrors"
echo "Upgrading slackpkg..."
mount $MIRROR
slackpkg update
slackpkg upgrade slackpkg
slackpkg new-config
echo
echo "Upgrading glibc-solibs"
yes n | slackpkg update
slackpkg upgrade glibc-solibs
echo
echo "Upgrading Slackware (incl. ktown)..."
slackpkg install ktown
slackpkg install-new
slackpkg upgrade ktown
slackpkg upgrade-all
slackpkg clean-system
slackpkg check-updates
slackpkg new-config
umount $MIRROR
echo
echo "Slackware upgraded."
echo
echo "Remaining .new and .orig files in /etc:"
find /etc -name "*.new" -o -name "*.orig" | egrep '.*' || echo none
echo
echo "WARNING!!! Kernel upgrades are intentionally blacklisted."
echo "If there is a kernel upgrade, run:"
echo
echo "minskyup kernel"
echo
}
# Upgrade kernel and boot partition
upkernel () {
# NOTE: make sure to uncomment the following lines in /etc/slackpkg/blacklist
# kernel-generic
# kernel-headers
# kernel-modules
# kernel-source
# Check for root
if [[ $EUID -ne 0 ]]; then
echo "Kernel upgrades are for root only."
exit 1
fi
set -e
MIRROR="/media/nas/mirrors"
SLACK="$MIRROR/slackware64-current/slackware64"
# Check kernel versions only
BUMP=FALSE
KNEW=$(grep "PACKAGE NAME: kernel-generic" /var/lib/slackpkg/PACKAGES.TXT | cut -d "-" -f3)
KFNEW=$SLACK/a/$(grep "PACKAGE NAME: kernel-generic" /var/lib/slackpkg/PACKAGES.TXT | cut -d " " -f4)
KCUR=$(uname -r)
KFCUR=$(ls -1 /boot/vmlinuz-generic-*.* | tail -1)
KDEL=$(ls -1 /boot/vmlinuz-generic-*.* | cut -d "/" -f3 | cut -d "-" -f3 | head -1)
KFDEL=$(ls -1 /boot/vmlinuz-generic-*.* | head -1)
# Mock kernel versions and files
#KNEW="4.19.66"
#KFNEW="$SLACK/a/kernel-generic-4.19.66-x86_64-2.txz"
#KCUR="4.19.66"
#KFCUR="/boot/vmlinuz-generic-4.19.66"
#KDEL="4.19.65"
#KFDEL="/boot/vmlinuz-generic-4.19.65"
KMSG2="- Slackware: $KNEW = $KFNEW"
KMSG3="- Slackprev: $KCUR = $KFCUR"
KMSG4="- DELETE : $KDEL = $KFDEL"
# Get kernel builds and transpose variables if bumped
KBNEW=$(grep "PACKAGE NAME: kernel-generic-$KNEW" /var/lib/slackpkg/PACKAGES.TXT | rev | cut -d "." -f2- | rev | cut -d "-" -f5)
KBCUR=$(ls -1at /var/lib/pkgtools/packages/kernel-generic-$KCUR-* | cut -d "/" -f6 | cut -d "-" -f5)
KBDEL=$(ls -1at /var/lib/pkgtools/packages/kernel-generic-$KDEL-* | cut -d "/" -f6 | cut -d "-" -f5)
# Mock kernel builds
#KBNEW="2"
#KBCUR="1"
#KBDEL="1"
if [ $KNEW == $KCUR ] && [ $KBNEW != $KBCUR ]; then
BUMP=TRUE
KTMP=$KDEL
KBTMP=$KBDEL
KFTMP=$KFDEL
KDEL=$KCUR
KBDEL=$KBCUR
KFDEL=$KFCUR
KCUR=$KTMP
KBCUR=$KBTMP
KFCUR=$KFTMP
KMSG1="BUMPED kernel $KNEW-$KBNEW available, current kernel is $KDEL-$KBDEL, upgrading boot menu:"
KMSG2="- Slackware: BUMP $KDEL-$KBDEL -> $KNEW-$KBNEW = $KFNEW"
KMSG3="- Slackprev: KEPT $KCUR = $KFCUR"
KMSG4="- DELETE : NONE"
KMSG5="- Packages: kernel-{modules,generic}, acpi_call and vboxdrv"
KMSG6="- Images : initrd, initrd-prev, recovery and memtest"
else
KMSG1="NEW kernel $KNEW available, current kernel is $KCUR, upgrading boot menu:"
KMSG5="- Packages: kernel-{source,headers,modules,generic}, acpi_call and vboxdrv"
KMSG6="- Images : initrd, initrd-prev, recovery and memtest"
fi
if [ $KNEW != $KCUR ] || [ $BUMP = TRUE ]; then
echo "${KMSG1}"
echo
echo "${KMSG2}"
echo "${KMSG3}"
echo "${KMSG4}"
echo
echo "The following resources will be upgraded:"
echo
echo "${KMSG5}"
echo "${KMSG6}"
echo
read -p "Press [CTRL-C] to abort or [Enter] to continue..."
echo
if [ $BUMP = TRUE ]; then
echo "BUMPING kernel $KDEL-$KBDEL to $KNEW-$KBNEW (> Slackware)..."
else
echo "DELETING kernel $KDEL (Slackprev > /dev/null)..."
fi
echo
removepkg kernel-modules-$KDEL-x86_64-$KBDEL
rm -rfv /lib/modules/$KDEL
echo
removepkg kernel-generic-$KDEL-x86_64-$KBDEL
echo
if [ $BUMP = FALSE ]; then
echo "Moving kernel $KCUR (Slackware > Slackprev)..."
echo
mv -fv /boot/initrd.gz /boot/initrd-prev.gz
mv -fv /boot/vmlinuz-generic /boot/vmlinuz-generic-prev
echo
fi
if [ $BUMP = TRUE ]; then
echo "Installing kernel $KNEW-$KBNEW (> Slackware)..."
else
echo "Installing kernel $KNEW (> Slackware)..."
fi
mount $MIRROR
echo
if [ $BUMP = FALSE ]; then
gpg --verify $SLACK/k/kernel-source-$KNEW-noarch-$KBNEW.txz.asc
echo
gpg --verify $SLACK/d/kernel-headers-$KNEW-x86-$KBNEW.txz.asc
echo
fi
gpg --verify $SLACK/a/kernel-modules-$KNEW-x86_64-$KBNEW.txz.asc
echo
gpg --verify $SLACK/a/kernel-generic-$KNEW-x86_64-$KBNEW.txz.asc
echo
if [ $BUMP = FALSE ]; then
upgradepkg $SLACK/k/kernel-source-$KNEW-noarch-$KBNEW.txz
echo
upgradepkg $SLACK/d/kernel-headers-$KNEW-x86-$KBNEW.txz
echo
fi
installpkg $SLACK/a/kernel-modules-$KNEW-x86_64-$KBNEW.txz
echo
installpkg $SLACK/a/kernel-generic-$KNEW-x86_64-$KBNEW.txz
echo
echo "Compiling acpi_call module for kernel $KNEW..."
sbopkg -i acpi_call:KERNEL=$KNEW
rm -fv acpi_call*.tgz
echo "Compiling vboxdrv modules for kernel $KNEW..."
export KERN_VER=$KNEW
/etc/rc.d/rc.vboxdrv setup
else
echo "Current kernel is $KNEW and there is no upgrade available."
echo "An updated initrd image can be created now."
echo
read -p "Press [CTRL-C] to abort or [Enter] to continue..."
fi
echo
if [ $BUMP = TRUE ]; then
echo "Creating initrd for kernel $KNEW-$KBNEW with the following command:"
else
echo "Creating initrd for kernel $KNEW with the following command:"
fi
echo
MKCMD=$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -a "-h /dev/cryptvg/swap -c -s /var/lib/initrd-tree/ -L -P /boot/intel-ucode.cpio -w 1" -m "i915:usb-storage" -r -k $KNEW)
echo "$MKCMD"
echo
read -p "Press [CTRL-C] to abort or [Enter] to continue..."
if [ -f /boot/elilo-x86_64.efi ]; then
rm -fv /boot/elilo*.efi
fi
if [ -d /boot/grub ]; then
rm -rfv /boot/grub
fi
if [ -d /boot/initrd-tree ]; then
rm -rfv /boot/initrd-tree
fi
$MKCMD
echo
if [ $KNEW != $KCUR ] || [ $BUMP = TRUE ]; then
echo "Upgrading recovery and memtest images..."
cp -fv /root/src/README.luks /boot/
mount -o loop $MIRROR/slackware64-current/usb-and-pxe-installers/usbboot.img /mnt/tmp
cp -fv /mnt/tmp/*.* /mnt/tmp/memtest /mnt/tmp/setpkg /boot/recovery/
umount /mnt/tmp
umount $MIRROR
if [ -d /boot/recovery/EFI ]; then
rm -rfv /boot/recovery/EFI
fi
echo
fi
echo "Updating LILO..."
lilo
echo
if [ $BUMP = FALSE ]; then
FMSG1="- Slackware: $KNEW (default)"
FMSG2="- Slackprev: $KCUR"
FMSG3="- DELETED : $KDEL is not available anymore."
FMSG4="Kernel $KNEW installed, reboot NOW!"
else
FMSG1="- Slackware: $KNEW-$KBNEW (default)"
FMSG2="- Slackprev: $KCUR"
FMSG3="- DELETED : NONE"
FMSG4="Kernel $KNEW-$KBNEW installed, reboot NOW!"
fi
if [ $KNEW != $KCUR ] || [ $BUMP = TRUE ]; then
echo "System is ready to boot by choosing at LILO menu:"
echo
echo "${FMSG1}"
echo "${FMSG2}"
echo "${FMSG3}"
echo
echo "${FMSG4}"
else
echo "initrd updated for kernel $KNEW, reboot when needed."
fi
echo
}
# Install/Upgrade VirtualBox
upvbox () {
VBCUR=$(vboxmanage --version|cut -d "r" -f1)
VBNEW=$(curl -s https://download.virtualbox.org/virtualbox/LATEST.TXT)
if [ $VBCUR != $VBNEW ]; then
echo "VirtualBox $VBCUR is the latest version, no upgrade required."
else
echo "VirtualBox $VBCUR installed, latest is $VBNEW."
echo "Do you want to upgrade VirtualBox now?"
echo
read -p "Press [CTRL-C] to abort or [Enter] to continue..."
echo
tmp="/tmp"
vbsumf="SHA256SUMS"
curl -s https://download.virtualbox.org/virtualbox/$VBNEW/$vbsumf -o $tmp/$vbsumf
vbsum=$(cat $tmp/$vbsumf | grep run | cut -d" " -f1)
vbrun=$(cat $tmp/$vbsumf | grep run | cut -d"*" -f2)
ver=$(echo $vbrun | cut -d "-" -f2)
rel=$(echo $vbrun | cut -d "-" -f3)
extp="Oracle_VM_VirtualBox_Extension_Pack-$ver-$rel.vbox-extpack"
esum=$(cat $tmp/$vbsumf | grep $extp | cut -d" " -f1)
echo "Downloading VirtualBox installer..."
sudo curl https://download.virtualbox.org/virtualbox/$ver/$vbrun -o $tmp/$vbrun
vbdlsum=$(sha256sum $tmp/$vbrun | cut -d" " -f1)
if [ $vbsum != $vbdlsum ]; then
echo "WARNING!!! VirtualBox installer checksum error."
echo
echo "$vbrun:"
echo "- Published : $vbsum"
echo "- Downloaded: $vbdlsum"
echo
echo "Cleaning up and exiting..."
sudo rm -rfv $tmp/$vbsumf $tmp/$vbrun
exit 3
else
echo "VirtualBox downloaded, checksum match."
fi
echo
echo "Downloading Extension Pack..."
sudo curl https://download.virtualbox.org/virtualbox/$ver/$extp -o $tmp/$extp
epdlsum=$(sha256sum $tmp/$extp | cut -d" " -f1)
if [ $esum != $epdlsum ]; then
echo "WARNING!!! Extension Pack checksum error."
echo
echo "$extp:"
echo "- Published : $vbsum"
echo "- Downloaded: $vbdlsum"
echo
echo "Cleaning up and exiting..."
sudo rm -rfv $tmp/$vbsumf $tmp/$vbrun $tmp/$extp
exit 4
else
echo "Extension Pack downloaded, checksum match."
fi
echo
echo "Installing VirtualBox $VBNEW..."
sudo chmod 755 $tmp/$vbrun
sudo TMPDIR=/tmp $tmp/$vbrun
echo "Installing VirtualBox Extension Pack $VBNEW..."
sudo TMPDIR=/tmp VBoxManage extpack install $tmp/$extp --replace \
--accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb
echo
echo "Updating modules, restarting and cleaning up..."
sudo /etc/rc.d/rc.vboxdrv setup
sudo rm -rfv $tmp/$vbsumf $tmp/$vbrun $tmp/$extp
echo
echo "VirtualBox and Extension Pack $(vboxmanage --version) are installed."
fi
}
# Install/Upgrade Vagrant
upvagrant () {
if [ -z $1 ]; then
echo "Vagrant version is required. Example:"
echo
echo "minskyup vagrant 2.1.2"
echo
echo "Run 'vagrant version' to check current and latest versions."
exit 5
fi
echo "Installing Vagrant $1..."
tmp="/tmp"
vrpm="vagrant_$1_x86_64.rpm"
vtgz="vagrant_$1_x86_64.tgz"
sudo curl https://releases.hashicorp.com/vagrant/$1/$vrpm -o $tmp/$vrpm
sudo rpm2tgz $tmp/$vrpm
sudo mv $vtgz $tmp/
oldv=$(find /var/lib/pkgtools/packages/ -name "vagrant*" | rev | cut -d"/" -f1 | rev)
sudo /sbin/removepkg $oldv
sudo /sbin/installpkg $tmp/$vtgz
sudo rm -rf $tmp/$vrpm $tmp/$vtgz
vagrant --version
}
# Install/Upgrade Docker
updocker () {
if [ -z $1 ]; then
echo "Docker CE version is required. Example:"
echo
echo "minskyup docker 18.06.0"
echo
echo "See https://download.docker.com/linux/static/stable/x86_64/ for available versions."
echo "Currently installed: $(docker --version)"
exit 6
fi
echo "Installing Docker $1-ce..."
tmp="/tmp"
dtgz="docker-$1-ce.tgz"
sudo curl https://download.docker.com/linux/static/stable/x86_64/$dtgz -o $tmp/$dtgz
sudo tar xvf $tmp/$dtgz -C $tmp
sudo chown -R root:root $tmp/docker
sudo mv -fv $tmp/docker/* /usr/bin/
sudo rm -rfv $tmp/$dtgz $tmp/docker
sudo /etc/rc.d/rc.dockerd stop
sudo /etc/rc.d/rc.dockerd start
docker --version
}
# Install/Upgrade AWS CLI
upaws () {
echo "Installing AWS CLI $1..."
tmp="/tmp"
aws="awscli-bundle"
sudo curl https://s3.amazonaws.com/aws-cli/$aws.zip -o $tmp/$aws.zip
sudo unzip -o $tmp/$aws.zip -d $tmp
sudo chown -R root:root $tmp/$aws
sudo $tmp/$aws/install -i /usr/local/aws -b /usr/local/bin/aws
sudo rm -rf $tmp/$aws.zip $tmp/$aws
aws --version
}
# Install/Upgrade cli53
upcli53 () {
if [ -z $1 ]; then
echo "cli53 version is required. Example:"
echo
echo "minskyup cli53 0.8.12"
echo
echo "See https://github.com/barnybug/cli53/releases/latest for the latest version."
echo "Currently installed: $(cli53 --version)"
exit 7
fi
echo "Installing cli53 $1..."
sudo curl -L https://github.com/barnybug/cli53/releases/download/$1/cli53-linux-amd64 -o /usr/local/bin/cli53
sudo chmod +x /usr/local/bin/cli53
cli53 --version
}
# Install/Upgrade hub
uphub () {
if [ -z $1 ]; then
echo "hub version is required. Example:"
echo
echo "minskyup hub 2.5.0"
echo
echo "See https://github.com/github/hub/releases/latest for the latest version."
echo "Currently installed:"
hub --version
exit 8
fi
echo "Installing hub $1..."
tmp="/tmp"
hub="hub-linux-amd64-$1"
sudo curl -L https://github.com/github/hub/releases/download/v$1/$hub.tgz -o $tmp/$hub.tgz
sudo tar xvf $tmp/$hub.tgz -C $tmp
sudo chown -R root:root $tmp/$hub
sudo $tmp/$hub/install
sudo rm -rf $tmp/$hub.tgz $tmp/$hub
hub --version
}
# Install/Upgrade jq
upjq () {
if [ -z $1 ]; then
echo "jq version is required. Example:"
echo
echo "minskyup jq 1.5"
echo
echo "See https://github.com/stedolan/jq/releases/latest for the latest version."
echo "Currently installed: $(jq --version)"
exit 9
fi
echo "Installing jq $1..."
tmp="/tmp"
jq="jq-linux64"
sudo curl -L https://github.com/stedolan/jq/releases/download/jq-$1/$jq -o $tmp/$jq
sudo chown root:root $tmp/$jq
sudo chmod +x $tmp/$jq
sudo mv $tmp/$jq /usr/local/bin/jq
jq --version
}
# Install/Upgrade phpMyAdmin
upphpmyadmin () {
tmp="/var/www/htdocs"
if [ -z $1 ]; then
echo "phpMyAdmin version is required. Example:"
echo
echo "minskyup phpmyadmin 4.8.2"
echo
echo "See https://www.phpmyadmin.net/downloads/ for the latest version."
rel=$(ls -1 $tmp/phpmyadmin/RELEASE-DATE-* | cut -d'-' -f3)
echo "Currently installed: phpmyadmin $rel"
exit 10
fi
echo "Installing phpmyadmin $1..."
pma="phpMyAdmin-$1-all-languages.tar.gz"
sudo curl -L https://files.phpmyadmin.net/phpMyAdmin/$1/$pma -o $tmp/$pma
sudo mv $tmp/phpmyadmin/config.inc.php $tmp/
sudo rm -rf $tmp/phpmyadmin
sudo mkdir -p $tmp/phpmyadmin/upload
sudo tar xvf $tmp/$pma -C $tmp/phpmyadmin/ --strip-components 1
sudo mv $tmp/config.inc.php $tmp/phpmyadmin/
sudo chown -R apache:apache $tmp/phpmyadmin
sudo rm -rf $tmp/$pma $tmp/phpmyadmin/setup
rel=$(stat $tmp/phpmyadmin/RELEASE-DATE-$1 -c%n | cut -d'-' -f3)
echo "phpmyadmin $rel"
}
# Install/Upgrade ngrok
upngrok () {
echo "Installing ngrok..."
tmp="/tmp"
ngrok="ngrok-stable-linux-amd64.zip"
sudo curl -L https://bin.equinox.io/c/4VmDzA7iaHb/$ngrok -o $tmp/$ngrok
sudo unzip -o $tmp/$ngrok -d $tmp
sudo chmod +x $tmp/ngrok
sudo mv $tmp/ngrok /usr/local/bin
sudo rm -rf $tmp/$ngrok
ngrok --version
}
# Install/Upgrade Spectre & Meltdown Checker
upsmc () {
echo "Installing Spectre & Meltdown Checker..."
tmp="/tmp"
smc="spectre-meltdown-checker"
sudo curl -L https://meltdown.ovh -o $tmp/$smc
sudo chmod +x $tmp/$smc
sudo mv $tmp/$smc /usr/local/bin
spectre-meltdown-checker --version
}
# Install/Upgrade testssl
uptssl () {
if [ -z $1 ]; then
echo "testssl version is required. Example:"
echo
echo "minskyup tssl 3.0rc5"
echo
echo "See https://github.com/drwetter/testssl.sh/releases/latest for the latest version."
echo "Currently installed:"
/opt/testssl/testssl.sh --version
exit 11
fi
echo "Installing testssl $1..."
pwd=$(pwd)
opt="/opt"
ttgz="$1.tar.gz"
tdir="testssl.sh-$1"
sudo curl -L https://github.com/drwetter/testssl.sh/archive/$ttgz -o $opt/$ttgz
sudo tar xvf $opt/$ttgz -C /opt
sudo rm -rf $opt/testssl
sudo mv $opt/$tdir $opt/testssl
sudo chown root:root $opt/testssl
sudo rm -rf $opt/$ttgz
sudo /opt/testssl/testssl.sh --version
}
# Install/Upgrade asciinema
upasciinema () {
if ! hash asciinema 2> /dev/null; then
echo "Installing asciinema..."
sudo pip3 install asciinema
else
echo "Upgrading asciinema..."
sudo pip3 install asciinema -U
fi
asciinema --version
}
# Install/Upgrade calibre
upcalibre () {
upg=0
lnc=0
if ! hash calibre 2> /dev/null; then
echo "Installing calibre..."
else
echo "Upgrading calibre..."
upg=1
if pgrep -cx "calibre" &> /dev/null; then
killall calibre &> /dev/null
lnc=1
fi
fi
wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | \
sudo python -c "import sys; main=lambda:sys.stderr.write(\"Download failed\n\"); exec(sys.stdin.read()); main()"
calibre --version
}
# Install/Upgrade pup
uppup () {
if ! hash pup 2> /dev/null; then
echo "Installing pup..."
go get -v github.com/ericchiang/pup
else
echo "Upgrading pup..."
go get -v -u github.com/ericchiang/pup
fi
pup --version
}
# Install/Upgrade Synology Cloud Drive
upsynology () {
if [ -z $1 ]; then
echo "Synology Drive version is required. Example:"
echo
echo "minskyup synology 1.1.1-10551"
echo
echo "See https://www.synology.com/en-global/support/download for the latest version (choose a recent product and look for Ubuntu64 links)."
exit 12
fi
upg=0
lnc=0
if ! hash synology-drive 2> /dev/null; then
echo "Installing Synology Drive..."
else
echo "Upgrading Synology Drive..."
upg=1
if pgrep -cx "cloud-drive-ui" &> /dev/null; then
synology-drive stop
lnc=1
fi
fi
tmp="/tmp"
ver=$(echo $1 | cut -d'-' -f1)
rel=$(echo $1 | cut -d'-' -f2)
ddeb="synology-drive-client-$rel.x86_64.deb"
dtxz="synology-drive-client-$rel.x86_64.txz"
sudo curl -l https://global.download.synology.com/download/Tools/SynologyDriveClient/$1/Ubuntu/Installer/x86_64/$ddeb -o $tmp/$ddeb
sudo deb2tgz $tmp/$ddeb
sudo mv $dtxz $tmp/
OLDSYNO=$(pkg synology-drive-client)
if [ -n $OLDSYNO ]; then
sudo /sbin/removepkg $OLDSYNO
fi
sudo /sbin/installpkg $tmp/$dtxz
sudo rm -rf $tmp/$ddeb $tmp/$dtxz
if [ $upg -eq 1 ]; then
if [ $lnc -eq 1 ]; then
synology-drive start
fi
fi
}
# Install/Upgrade Zoom
upzoom () {
upg=0
lnc=0
bin="$HOME/opt/bin"
if [ ! -x $bin/zoom/ZoomLauncher ]; then
echo "Installing Zoom..."
else
echo "Upgrading Zoom..."
upg=1
if pgrep -cx "zoom" &> /dev/null; then
killall zoom &> /dev/null
lnc=1
fi
fi
ztxz="zoom_x86_64.tar.xz"
curl -L https://zoom.us/client/latest/$ztxz -o $bin/$ztxz
tar xvf $bin/$ztxz -C $bin
rm -rf $bin/$ztxz
if [ $upg -eq 1 ]; then
if [ $lnc -eq 1 ]; then
$bin/zoom/ZoomLauncher &
fi
else
pwd=$(pwd)
cd $bin/zoom/RegisterProtocol
bash RegisterProtocol.sh
fi
}
# Main execution
case "$1" in
"info")
upinfo
;;
"mirror")
upmirror
;;
"slack")
upos $2
;;
"kernel")
upkernel
;;
"vbox")
upvbox
;;
"vagrant")
upvagrant $2
;;
"docker")
updocker $2
;;
"aws")
upaws
;;
"cli53")
upcli53 $2
;;
"hub")
uphub $2
;;
"jq")
upjq $2
;;
"ngrok")
upngrok
;;
"phpmyadmin")
upphpmyadmin $2
;;
"smc")
upsmc
;;
"tssl")
uptssl $2
;;
"asciinema")
upasciinema
;;
"calibre")
upcalibre
;;
"pup")
uppup
;;
"synology")
upsynology $2
;;
"zoom")
upzoom
;;
*)
echo "Usage: misnkyup <info|mirror|slack|kernel|vbox|vagrant|docker|aws|cli53|hub|jq|ngrok|phpmyadmin|smc|tssl|asciinema|calibre|pup|synology|zoom>"
;;
esac
#/usr/bin/env bash
complete -W "info mirror slack kernel vbox vagrant docker aws cli53 hub jq ngrok phpmyadmin smc tssl asciinema calibre pup synology zoom" minskyup
# Global section is intentionally supressed.
# Linux current kernel config begins
image = /boot/vmlinuz-generic
initrd = /boot/initrd.gz
root = /dev/cryptvg/root
label = Slackware
read-only # Partitions should be mounted read-only for checking
# Linux current kernel config ends
# Linux previous kernel config begins
image = /boot/vmlinuz-generic-prev
initrd = /boot/initrd-prev.gz
root = /dev/cryptvg/root
label = Slackprev
read-only # Partitions should be mounted read-only for checking
# Linux previous kernel config ends
# Slackware recovery begins
image = /boot/recovery/huge.s
label = Recovery
initrd = /boot/recovery/initrd.img
password = ***
read-only
# Slackware recovery ends
# Memtest begins
image = /boot/recovery/memtest
label = Memtest
password = ***
read-only
# Memtest ends
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment