From a94dfc06f6c8970d70a4656672d8659d13860961 Mon Sep 17 00:00:00 2001 From: shelldweller Date: Mon, 12 Jun 2023 18:42:33 -0500 Subject: [PATCH] create new repository for these scripts --- README.md | 68 ++++++++- linux-libre-firmware-builder-installer.sh | 116 +++++++++++++++ linux-libre-kernel-builder-installer.sh | 170 ++++++++++++++++++++++ remove-blacklist-nonfree-packages.sh | 73 ++++++++++ slackware2freenix.sh | 43 ++++++ 5 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 linux-libre-firmware-builder-installer.sh create mode 100644 linux-libre-kernel-builder-installer.sh create mode 100644 remove-blacklist-nonfree-packages.sh create mode 100644 slackware2freenix.sh diff --git a/README.md b/README.md index a6d57b0..a0ce967 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,67 @@ -# Slack2Freenix +A project in the works to convert an installed Slackware-15.0 system into a Freenix-15.0 system. +Both 64-bit and 32-bit versions can be converted. -A set of scripts to transform a stock Slackware-15.0 installation into something resembling what Freenix-15.0 would be. \ No newline at end of file +There are 4 scripts in total: + +1) slackware2freenix.sh + +This is a meta-script that just runs the other three without any arguments. +Needs to be run as root. + + +2) remove-blacklist-nonfree-packages.sh + +This removes and blacklists all non-free packages as per freenix.net. +This script can probably be run on any Slackware-based derivative, as long as slackpkg is present. + +arguments: + +BLACKLISTFILE = the location of your slackpkg blacklist file (default = /etc/slackpkg/blacklist) + + +3) linux-libre-kernel-build-instsall.sh + +This builds and installs the Linux-Libre kernel, headers, modules. +Modifies stock kernel-configs and SlackBuild files. + +arguments: + +STOCKVERSION = version of stock kernel to use kernel-configs from (default grabs latest from repo) + +MAJORVERSION = branch of libre kernel to build from (defaults to stock kernel branch, i.e. 5.15) + +LIBREVERSION = version of Linux-libre acutally being builg (defaults to latest version in MAJORVERSION branch) + +RELEASE = release version of Slackware (i.e. 15.0). Fetches from running system by default. + +REPOURL = URL of your preferred repo. (default = https://mirrors.slackware.com) + +BUILDDIR = directory to build kernels in. (default =/tmp/linux-libre-4-freenix) + +BLACKLISTFILE = the location of your slackpkg blacklist file (default = /etc/slackpkg/blacklist) + +INSTALL_KERNEL = install packages after building them (default = no) + + +4) linux-libre-firmware-build-install.sh + +This builds and installs the Linux-libre firmware. +Modifies stock SlackBuild file. + +arguments: + +RELEASE = release version of Slackware (i.e. 15.0). Fetches from running system by default. + +REPOURL = URL of your preferred repo. (default = https://mirrors.slackware.com) + +BUILDDIR = directory to build kernels in. (default =/tmp/linux-libre-4-freenix) + +BLACKLISTFILE = the location of your slackpkg blacklist file (default = /etc/slackpkg/blacklist) + +INSTALL_FIRMWARE = install packages after building them (default = no) + + +NOTE: The script DOES NOT clean up after itself. +You are invited to delete any leftover files and directories in /tmp/ . +However, the modified SlackBuild scripts and kernel packages all reside there. +You may want to save or share these before clearing out /tmp/ . diff --git a/linux-libre-firmware-builder-installer.sh b/linux-libre-firmware-builder-installer.sh new file mode 100644 index 0000000..57ee6e4 --- /dev/null +++ b/linux-libre-firmware-builder-installer.sh @@ -0,0 +1,116 @@ +#!/bin/bash +####################################################################### +# Slackware(64)-15.0 to Freenix(64)-15.0 script, part 3 +# Linux-Libre firmware builder and installer +# written by krt@beauxbead.com / krt.beauxbead.com +# Released under the WTFPL 2.0 http://www.wtfpl.net/ +# +# This is intended to be run as root. It builds the latest Linux-libre +# firmware and upgrades the stock firmware package to the libre one. +# Works on both 32-bit and 64-bit installations of Slackware 15.0. +# Slackware derivatives might also work, this is untested though. +# +# No guarantees are given, this script is highly experimental. +# Feel free to make changes and share with the community. +####################################################################### + +# where is this script being run from? +CWD0=$(pwd) + +# future proof the release version number +# to-do: make this work on -current? +RELEASE=${RELEASE:-$(grep '^VERSION=' /etc/os-release | cut -d '=' -f 2 | sed 's/"//g')} + +# Uses mirrors.slackware.com to find a mirror near you, feel free to change to a local mirror +REPOURL=${REPOURL:-'https://mirrors.slackware.com'} + +# prepare for kernel building +BUILDDIR=${BUILDDIR:-'/tmp/linux-libre-4-freenix'} + +# Set blacklist file, just in case... +BLACKLISTFILE=${BLACKLISTFILE:-'/etc/slackpkg/blacklist'} + +# Set variable to 'yes' to install package after building: +INSTALL_FIRMWARE=${INSTALL_FIRMWARE:-'no'} + +# download linux-libre firmware +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Downloading Linux-Libre firmware" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +rm -r ${BUILDDIR}/firmware +mkdir ${BUILDDIR}/firmware +cd ${BUILDDIR}/firmware +wget $REPOURL/slackware/slackware64-$RELEASE/source/a/kernel-firmware/kernel-firmware.SlackBuild +wget $REPOURL/slackware/slackware64-$RELEASE/source/a/kernel-firmware/slack-desc +cp kernel-firmware.SlackBuild kernel-firmware-gnu.SlackBuild +chmod a+x kernel-firmware-gnu.SlackBuild + +# patch SlackBuild and slack-desc to fit linux-libre-firmware using: +# sed -i 's/ --- / --- /' slack-desc +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Patching SlackBuild and slack-desc files for linux-libre" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +# patch kernel-firmware.SlackBuild +sed -i 's/PKGNAM=kernel-firmware/PKGNAM=kernel-firmware-gnu/' kernel-firmware-gnu.SlackBuild +sed -i 's/.*git.kernel.org\/pub\/scm\/linux\/kernel\/git\/firmware\/linux-firmware.git\/commit\/?id=HEAD | grep " committer " | head -n 1 | rev | cut -f 3 -d.*/ DATE="$(lynx -dump -width=256 https:\/\/jxself.org\/git\/linux-libre-firmware.git | grep "last change" | head -n 1 | cut -f 2 -d "," | cut -d" " -f2-4 | tr -d " ")"/' kernel-firmware-gnu.SlackBuild +sed -i 's/https:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/firmware\/linux-firmware.git\/commit\/?id=HEAD | grep " commit " | head -n 1 | cut -f 2 -d ] | cut -b 1-7/"https:\/\/jxself.org\/git\/?p=linux-libre-firmware.git;a=commit" | grep " commit " | head -n 1 | cut -b 14-20/' kernel-firmware-gnu.SlackBuild +sed -i 's/git:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/firmware\/linux-firmware.git/https:\/\/jxself.org\/git\/linux-libre-firmware.git/' kernel-firmware-gnu.SlackBuild +sed -i 's/kernel-firmware-$/kernel-firmware-gnu-$/' kernel-firmware-gnu.SlackBuild +sed -i 's/mv linux-firmware/mv linux-libre-firmware/' kernel-firmware-gnu.SlackBuild +sed -i 's/kernel-firmware-${DATE}/kernel-firmware-gnu-${DATE}/' kernel-firmware-gnu.SlackBuild +# patch slack-desc +sed -i 's/kernel-firmware/kernel-firmware-gnu/' slack-desc +sed -i 's/kernel-firmware (Firmware for the kernel)/kernel-firmware-gnu (Firmware for the kernel)/' slack-desc +sed -i 's/Linux/Linux-libre/' slack-desc +sed -i 's/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/firmware\/linux-firmware.git/jxself.org\/git\/linux-libre-firmware.git/' slack-desc + +# build firmware package +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Building Linux-Libre firmware" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +TMP=${BUILDDIR}/firmware ./kernel-firmware-gnu.SlackBuild + +if [ $INSTALL_FIRMWARE == 'no' ]; then + +# that should do it! +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Linux-libre firmware has been built." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +cd ${CWD0} + +exit 0 + +fi + +# Remove stock firmware package +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Removing stock firmware package" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +removepkg kernel-firmware + +# install firmware package +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Installing Linux-Libre firmware" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +installpkg ${BUILDDIR}/firmware/kernel-firmware-gnu* + +# Add non-free packages to blacklist if not already blacklisted +if ! grep -q "kernel-firmware" $BLACKLISTFILE ; then + +# Blacklist stock firmware package +echo 'kernel-firmware' >> $BLACKLISTFILE + +# Print out new blacklist +cat $BLACKLISTFILE +fi + +# that should do it! +echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' +echo '% Linux-libre firmware has been built and installed.' +echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' +cd ${CWD0} + +exit 0 diff --git a/linux-libre-kernel-builder-installer.sh b/linux-libre-kernel-builder-installer.sh new file mode 100644 index 0000000..f04e6f4 --- /dev/null +++ b/linux-libre-kernel-builder-installer.sh @@ -0,0 +1,170 @@ +#!/bin/bash +####################################################################### +# Slackware(64)-15.0 to Freenix(64)-15.0 script, part 2: +# Linux-Libre kernel builder and package installer +# written by krt@beauxbead.com / krt.beauxbead.com +# Released under the WTFPL 2.0 http://www.wtfpl.net/ +# +# This is intended to be run as root. It builds the latest Linux-libre +# kernel for your architecture from the same branch as the upstream +# stock kernel. Works on both 32-bit and 64-bit installations of +# Slackware 15.0 . +# +# No guarantees are given, this script is highly experimental. +# Feel free to make changes and share with the community. +####################################################################### + +# where is this script being run from? +CWD0=$(pwd) + +# Set blacklist file, just in case... +BLACKLISTFILE=${BLACKLISTFILE:-'/etc/slackpkg/blacklist'} + +# Set variable to 'yes' to install packages after building: +INSTALL_KERNEL=${INSTALL_KERNEL:-'no'} + +# future proof the release version number +# to-do: make this work on -current? +RELEASE=${RELEASE:-$(grep '^VERSION=' /etc/os-release | cut -d '=' -f 2 | sed 's/"//g')} + +# prepare for kernel building +BUILDDIR=${BUILDDIR:-'/tmp/linux-libre-4-freenix'} +rm -r ${BUILDDIR} +mkdir ${BUILDDIR} +cd ${BUILDDIR} + +# Uses mirrors.slackware.com to find a mirror near you, feel free to change to a local mirror +REPOURL=${REPOURL:-'https://mirrors.slackware.com'} +# Set latest stock version here +STOCKVERSION=${STOCKVERSION:-$(wget -q -O - $REPOURL/slackware/slackware64-$RELEASE/patches/source/ | grep -o -P '(?<=>linux-).*(?=\/<)')} + +# download kernel SlackBuild scripts +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Downloading stock kernel SlackBuild files." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-generic.SlackBuild +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-headers.SlackBuild +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-modules.SlackBuild +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-source.SlackBuild +chmod a+x *.SlackBuild + +# use olddefconfig instead of oldconfig to accept defaults since last stock kernel update. +sed -i 's/oldconfig/olddefconfig/' kernel-generic.SlackBuild +sed -i 's/oldconfig/olddefconfig/' kernel-modules.SlackBuild +sed -i 's/oldconfig/olddefconfig/' kernel-source.SlackBuild + +# use MAJORVERSION to change branches if you wish +MAJORVERSION=${MAJORVERSION:-$(wget -q -O - $REPOURL/slackware/slackware64-$RELEASE/patches/source/ | grep -o -P '(?<=>linux-).*(?=\/<)' | sed 's/\.[^.]*$//')} + +# download latest Linux-Libre source in the same branch as the stock kernel +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Downloading Linux-Libre source." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +wget -r -l1 -np -nd "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-${MAJORVERSION}.N" -A "linux-libre-${MAJORVERSION}.*-gnu.tar.lz*" +wget -r -l1 -np -nd "http://linux-libre.fsfla.org/pub/linux-libre/releases/LATEST-${MAJORVERSION}.N" -A "linux-libre-${MAJORVERSION}.*-gnu.tar.sign" +wget http://linux-libre.fsfla.org/pub/linux-libre/SIGNING-KEY.linux-libre +gpg --import SIGNING-KEY.linux-libre +gpg --verify *tar.lz.sign +LIBREVERSION=${LIBREVERSION:-$(ls linux-libre-*-gnu.tar.lz | sed 's/[^0-9.]*//g' | sed 's/..$//')} + +ln -s linux-libre-${LIBREVERSION}-gnu.tar.lz linux-${LIBREVERSION}.tar.lz + +# grab most recent stock kernel-configs and use them as latest libre-configs +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Downloading stock kernel-configs for use with libre-kernel." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +mkdir kernel-configs +cd kernel-configs +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-generic-${STOCKVERSION} -O config-generic-${LIBREVERSION} +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-generic-${STOCKVERSION}.x64 -O config-generic-${LIBREVERSION}.x64 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-generic-smp-${STOCKVERSION}-smp -O config-generic-smp-${LIBREVERSION}-smp +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-huge-${STOCKVERSION} -O config-huge-${LIBREVERSION} +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-huge-${STOCKVERSION}.x64 -O config-huge-${LIBREVERSION}.x64 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/kernel-configs/config-huge-smp-${STOCKVERSION}-smp -O config-huge-smp-${LIBREVERSION}-smp +cd ../ + +# Grab slack-desc files for packaging later +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Downloading slack-desc files for kernel-packages." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +mkdir slack-desc +cd slack-desc +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-generic-smp.i686 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-generic.i586 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-generic.x86_64 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-headers +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-huge-smp.i686 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-huge.i586 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-huge.x86_64 +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-modules_template +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-source +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-source.vanilla +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/slack-desc/slack-desc.kernel-template +cd ../ + +# Build Linux-Libre packages +wget $REPOURL/slackware/slackware64-$RELEASE/patches/source/linux-${STOCKVERSION}/build-all-kernels.sh +chmod +x build-all-kernels.sh +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Now building the kernels using Pat's script, this may take some time." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +INSTALL_PACKAGES=NO ./build-all-kernels.sh +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% We're done with Pat's script. Thanks Pat!" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +if [ $INSTALL_KERNEL == 'no' ]; then + +# that should do it! +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Linux-libre kernel packages have been built." +echo "% The last step is to build the firmware package, do this by running:" +echo "% ./linux-libre-firmware-builder-installer.sh" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +cd ${CWD0} + +exit 0 + +fi + +# Upgrade kernel packages all at once +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Upgrading stock kernel packages to libre kernel packages." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +upgradepkg /tmp/output-*/kernel-*.t?z + +# Now generate new initrd and update the bootloader +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Running genintird and lilo." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +geninitrd +lilo + +# Add non-free packages to blacklist if not already blacklisted +if ! grep -q "Kernel packages removed to prevent stock kernel being reinstalled" $BLACKLISTFILE ; then + +# Blacklist stock kernel packages +echo "#" >> $BLACKLISTFILE +echo "###################################################################" >> $BLACKLISTFILE +echo "# Kernel packages removed to prevent stock kernel being reinstalled" >> $BLACKLISTFILE +echo "kernel-generic.*" >> $BLACKLISTFILE +echo "kernel-headers.*" >> $BLACKLISTFILE +echo "kernel-huge.*" >> $BLACKLISTFILE +echo "kernel-modules.*" >> $BLACKLISTFILE +echo "kernel-source" >> $BLACKLISTFILE +echo "kernel.*" >> $BLACKLISTFILE + +# Print out new blacklist +cat $BLACKLISTFILE + +fi + +# that should do it! +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Stock kernel packages have been upgraded to libre kernel packages." +echo "% The last step is to upgrade the firmware package, do this by running:" +echo "% ./linux-libre-firmware-builder-installer.sh" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +cd ${CWD0} + +exit 0 diff --git a/remove-blacklist-nonfree-packages.sh b/remove-blacklist-nonfree-packages.sh new file mode 100644 index 0000000..36f2300 --- /dev/null +++ b/remove-blacklist-nonfree-packages.sh @@ -0,0 +1,73 @@ +#!/bin/bash +################################################################################### +# Slackware(64)-15.0 to Freenix(64)-15.0 script, part 1: +# Non-free package remover and blacklister +# written by krt@beauxbead.com / krt.beauxbead.com +# Released under the WTFPL 2.0 http://www.wtfpl.net/ +# +# This is intended to be run ONCE as root on a fully updated stock system. +# It removes all non-free packages (as deemed by freenix.net) and adds each +# one to the system blacklist. +# +# Works on both 32-bit and 64-bit installations of Slackware 15.0, as well as +# ARM-based Slackware variants and other derivatives (not fully tested). +# +# No guarantees are given, this script is highly experimental. +# Feel free to make changes and share with the community. +# +#################################################################################### + +# Set blacklist file, just in case... +BLACKLISTFILE=${BLACKLISTFILE:-"/etc/slackpkg/blacklist"} + +# Remove non-free stock packages from full stock installation +# Comment out any you'd like to keep +removepkg \ + amp \ + bluez-firmware \ + font-bh-ttf \ + font-bh-type1 \ + ipw2100-fw \ + ipw2200-fw \ + mozilla-firefox \ + mozilla-thunderbird \ + seamonkey \ + skkdic \ + unarj \ + xgames \ + zd1211-firmware \ + +# Add non-free packages to blacklist if not already blacklisted +if ! grep -q "Non-free packages removed as per freenix.net" $BLACKLISTFILE ; then + +# Comment out any to be excluded from blacklist +echo "#" >> $BLACKLISTFILE +echo "##############################################" >> $BLACKLISTFILE +echo "# Non-free packages removed as per freenix.net" >> $BLACKLISTFILE +echo "amp" >> $BLACKLISTFILE +echo "bluez-firmware" >> $BLACKLISTFILE +echo "font-bh-ttf" >> $BLACKLISTFILE +echo "font-bh-type1" >> $BLACKLISTFILE +echo "ipw2100-fw" >> $BLACKLISTFILE +echo "ipw2200-fw" >> $BLACKLISTFILE +echo "mozilla-firefox" >> $BLACKLISTFILE +echo "mozilla-thunderbird" >> $BLACKLISTFILE +echo "seamonkey" >> $BLACKLISTFILE +echo "skkdic" >> $BLACKLISTFILE +echo "unarj" >> $BLACKLISTFILE +echo "xgames" >> $BLACKLISTFILE +echo "zd1211-firmware" >> $BLACKLISTFILE + +fi + +# Print out new blacklist +cat $BLACKLISTFILE + +# Prepare for kernel building +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% Non-free software is removed and blacklisted." +echo "% To (re)build a libre kernel for your system, run: " +echo "% ./linux-libre-kernel-builder-installer.sh" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +exit 0 diff --git a/slackware2freenix.sh b/slackware2freenix.sh new file mode 100644 index 0000000..b2c48f1 --- /dev/null +++ b/slackware2freenix.sh @@ -0,0 +1,43 @@ +#!/bin/bash +####################################################################### +# Slackware(64)-15.0 to Freenix(64)-15.0 script, all three parts: +# Remove nonfree packages, build & install libre kernel & firmware +# written by krt@beauxbead.com / krt.beauxbead.com +# Released under the WTFPL 2.0 http://www.wtfpl.net/ +# +# This is intended to be run as root. It builds the latest Linux-libre +# kernel for your architecture from the same branch as the upstream +# stock kernel. Works on both 32-bit and 64-bit installations of +# Slackware 15.0 . +# +# No guarantees are given, this script is highly experimental. +# Feel free to make changes and share with the community. +####################################################################### + +# remove and blacklist non-free packages +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% remove and blacklist non-free packages" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +./remove-blacklist-nonfree-packages.sh +# Build and install linux-libre kernel packages +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% build and install Linux-libre kernel packages" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +INSTALL_KERNEL='yes' ./linux-libre-kernel-builder-installer.sh +# Build and install linux-libre firmware package +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% build and install Linux-libre firmware package" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +INSTALL_FIRMWARE='yes' ./linux-libre-firmware-builder-installer.sh +# Say goodbye... +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "% You are now fully liberated, you can reboot the system." +echo "% This script does not clean up after itself, you can" +echo "% manually remove the files in /tmp/, however the packages" +echo "% and SlackBuilds that resulted from this process are there" +echo "% in case you want to save or share them for any reason." +echo "% " +echo "% Welcome to Freenix. See https://freenix.net/ for more." +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +exit 0