<commit_before>#!/bin/sh
## run as root
# curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | sh

if [ ! $UID = 0 ]; then
  cat << EOF
This script must be run as root.
EOF
  exit 1
fi

if [ -d ~/Bumblebee-SlackBuilds/ ]; then
  cat << EOF
You already have the bumblebee directory,
please rename to avoid changes you may have made.
EOF
  exit 1
fi

if [ "$( uname -m )" = "x86_64" ] && [ -e /lib/libc.so.6 ]; then
  export COMPAT32=yes;
fi

install_latest_pkg() {
  PACKAGE=$1
  cd $PACKAGE/
  ./$PACKAGE.SlackBuild
  ls -t --color=never /tmp/$PACKAGE-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
}

no_prompt_sbo_pkg_install() {
SBO_PACKAGE=$1
if [ ! -e /var/log/packages/$SBO_PACKAGE-* ]; then
echo p | sbopkg -B -e continue -i $SBO_PACKAGE
fi
}

cd
git clone https://github.com/WhiteWolf1776/Bumblebee-SlackBuilds.git

wget -N https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee-reinstall.sh -P ~/Bumblebee-SlackBuilds

cd Bumblebee-SlackBuilds/
./download.sh

groupadd bumblebee
## add all non-root users (except ftp) to bumblebee group
cat /etc/passwd | grep "/home" | cut -d: -f1 | sed '/ftp/d' | xargs -i usermod -G bumblebee -a {}

install_latest_pkg libbsd

exit 1

cd ../bumblebee/
./bumblebee.SlackBuild
ls -t --color=never /tmp/bumblebee-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}

cd ../bbswitch/
./bbswitch.SlackBuild
ls -t --color=never /tmp/bbswitch-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}

cd ../primus/
if [ "$COMPAT32" = yes ]; then
  COMPAT32=yes ./primus.SlackBuild
else
  ./primus.SlackBuild
fi
ls -t --color=never /tmp/primus-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}

cd ../nouveau-blacklist/
upgradepkg --reinstall xf86-video-nouveau-blacklist-noarch-1.txz
if [ -z "$( cat /etc/slackpkg/blacklist | grep xf86-video-nouveau )" ]; then
  echo xf86-video-nouveau >> /etc/slackpkg/blacklist
fi
if [ -z "$( cat /etc/slackpkg/blacklist | grep _bbsb )" ]; then
  echo "[0-9]+_bbsb" >> /etc/slackpkg/blacklist
fi

cd ../libvdpau/
./libvdpau.SlackBuild
ls -t --color=never /tmp/libvdpau-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}

cd ../nvidia-kernel/
if [ "$COMPAT32" = yes ]; then
  COMPAT32=yes ./nvidia-kernel.SlackBuild
else
  ./nvidia-kernel.SlackBuild
fi
ls -t --color=never /tmp/nvidia-kernel-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}

cd ../nvidia-bumblebee/
if [ "$COMPAT32" = yes ]; then
  COMPAT32=yes ./nvidia-bumblebee.SlackBuild
else
  ./nvidia-bumblebee.SlackBuild
fi
ls -t --color=never /tmp/nvidia-bumblebee-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
<commit_msg>use functions remove libvdpau<commit_after>#!/bin/sh
## run as root
# curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | sh

if [ ! $UID = 0 ]; then
  cat << EOF
This script must be run as root.
EOF
  exit 1
fi

if [ -d ~/Bumblebee-SlackBuilds/ ]; then
  cat << EOF
You already have the bumblebee directory,
please rename to avoid changes you may have made.
EOF
  exit 1
fi

if [ "$( uname -m )" = "x86_64" ] && [ -e /lib/libc.so.6 ]; then
  export COMPAT32=yes;
fi

install_latest_pkg() {
  PACKAGE=$1
  cd $PACKAGE/
  ./$PACKAGE.SlackBuild
  ls -t --color=never /tmp/$PACKAGE-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
}

install_latest_pkg_compat() {
  PACKAGE=$1
  cd $PACKAGE/
  if [ "$COMPAT32" = yes ]; then
    COMPAT32=yes ./$PACKAGE.SlackBuild
  else
    ./$PACKAGE.SlackBuild
  fi
  ls -t --color=never /tmp/$PACKAGE-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
}


cd
git clone https://github.com/WhiteWolf1776/Bumblebee-SlackBuilds.git

wget -N https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee-reinstall.sh -P ~/Bumblebee-SlackBuilds

cd Bumblebee-SlackBuilds/
./download.sh

groupadd bumblebee
## add all non-root users (except ftp) to bumblebee group
cat /etc/passwd | grep "/home" | cut -d: -f1 | sed '/ftp/d' | xargs -i usermod -G bumblebee -a {}

install_latest_pkg libbsd

install_latest_pkg bumblebee

install_latest_pkg bbswitch

install_latest_pkg_compat primus

cd ../nouveau-blacklist/
upgradepkg --reinstall xf86-video-nouveau-blacklist-noarch-1.txz
if [ -z "$( cat /etc/slackpkg/blacklist | grep xf86-video-nouveau )" ]; then
  echo xf86-video-nouveau >> /etc/slackpkg/blacklist
fi
if [ -z "$( cat /etc/slackpkg/blacklist | grep _bbsb )" ]; then
  echo "[0-9]+_bbsb" >> /etc/slackpkg/blacklist
fi

install_latest_pkg_compat nvidia-kernel

install_latest_pkg_compat nvidia-bumblebee

{'fraction_non_alphanumeric': 0.1484540448962304, 'fraction_numerical': 0.016518424396442185, 'mean_word_length': 3.365064695009242, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447367', 'n_tokens_mistral': 1976, 'n_tokens_neox': 1875, 'n_words': 446}