NEETBSD - the comfy NetBSD post-installation script!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.7 KiB

#!/bin/sh
# NEETBSD
#
# NetBSD post-installation script via pkgin <https://pkgin.net/>.
#
# DETAILS
#
# NEETBSD packages: enlightenment firefox-esr xfe grafx2 mpv dillo mumble
# qbittorrent psi kvirc lxqt-archiver stalonetray eterm
# nano htop mc ncdu ufetch wget
# NEETBSD extras: neetpkg.sh (graphical package manager)
#
# LICENSE
#
# Project released under the terms of the WTFPL version 2 - stored as LICENSE.
# <http://www.wtfpl.net/txt/copying/>
echo 'NEETBSD' && echo '<!!!> UNFINISHED SCRIPT DO NOT USE' # DEV warning
# SOFTWARE INSTALLATION
echo 'Installing software for NEETBSD'
# BINARY PACKAGES via pkgin
echo 'Installing binary packages via the root user using su'
echo 'This operation might take a long moment to complete!!'
su root -c 'pkgin -y install enlightenment firefox-esr xfe grafx2 mpv dillo mumble qbittorrent psi kvirc lxqt-archiver stalonetray eterm nano htop mc ncdu ufetch wget'
# FIX-ME: uncertain packages are left out - xine/mpv(?)
# COMPILATION via various utilities
echo 'Software compilation - this operation should be rapid'
# Is it installed? `command -v` is +/- equivalent to `which`
if [ -x "$(command -v xdiskusage)" ]; then
echo 'xdiskusage is already installed.'
else
echo 'Compiling xdiskusage'
echo '<!!!> xdiskusage version 1.60 - please check if this is the latest!'
wget --quiet -O - https://xdiskusage.sourceforge.net/ | grep 'Download source'
sleep 5 # Some time to read the above warning and result
su root -c 'pkgin -y install fltk-1.3.9' # FLTK is the sole dependency
wget https://xdiskusage.sourceforge.net/xdiskusage-1.60.tgz # Download src
mv xdiskusage-1.60.tgz /tmp # This operation shall be done in a tmp area
cd /tmp
tar xfv xdiskusage-1.60.tgz # Extract
cd xdiskusage-1.60
sed -i 's/(__APPLE__)/(__NetBSD__)/g' xdiskusage.C # sed replacing 'APPLE' with 'NetBSD'
# ^ xdiskusage now acts like the FreeBSD version - probably hacky, but it seems functional
# Configure, compile, install, clean
./configure && make CPPFLAGS=-I/usr/pkg/include CPPFLAGS+=-I/usr/X11R7/include && su root -c 'make install clean'
# .desktop ... apparently redundant with Enlightenment already detecting xdu but well
su root -c 'mkdir /usr/local/share/applications/ && printf "[Desktop Entry]\nType=Application\nName=xdiskusage\nComment=Graphical disk usage program\nTerminal=false\nTryExec=xdiskusage\nExec=/usr/local/bin/xdiskusage\nCategories=Utility" > /usr/local/share/applications/xdiskusage.desktop'
cd .. # Go back to /tmp
rm -r /tmp/xdiskusage-1.60* # Erase tmp compilation data
echo 'Software compilation done'
fi
echo 'SOFTWARE INSTALLATION FINISHED'
# SOFTWARE COMFY-GURATION
echo 'Configuring the installed packages...'
echo 'Creating ~/.xinitrc'
# Back up the previous .xinitrc if it exists
mv ~/.xinitrc ~/.xinitrc.old && echo 'Previous .xinitrc backed up as .xinitrc.old'
printf 'exec enlightenment_start\n' > ~/.xinitrc.tmp # Start enlightenment
cat ~/.xinitrc.tmp ~/.xinitrc.old > ~/.xinitrc # Merge the command for e. with the old xinitrc
rm ~/.xinitrc.tmp # Erase the temporary xinitrc
# RESULTING .xinitrc:
# exec enlightenment_start
# exec stalonetray
# [Previous .xinitrc content if it existed]
# TO-DO: ~/.e/ for Enlightenment
# TO-DO: stalonetray auto-start (unsuccessfully tried ~/.xinitrc + ~/.e/e/applications/startup/.order)
# TO-DO: Firefox extensions - uBlock Origin, LibRedirect, Block Cloudflare, and Paxmod.
echo 'CONFIGURATION FINISHED'
# NEETBSD EXTRAS
# neetpkg.sh
echo 'Installing the graphical package manager neetpkg'
# TO-DO - see <https://pkgin.net/#usage>:
# <!!!> - `full-upgrade` is deprecated!!!
# Using xmessage (msg+menu), xedit (lists), and xterm (text input)
#
# 1. [Update] (`up/upgrade`)
# 2. [Upgrade] (`ug/upgrade`)
# 3. [List available packages] (`av/avail`)
# 4. [List installed packages] (`ls/list`)
# 5. [List packages from a category] (`sc/show-category`)
# 6. [Search] (`se/search`)
# 7. [Install] (`in/install`, regex-capable, approval (`-y`) implied)
# 8. [Remove] (`rm/remove` rm pkg + reverse deps = direct + ind. deps)
# 9. [Remove orphan packages] (`ar/autoremove`)
# 10. Etc.
# a. [Stastistic] (`st/stats`)
# b. [List categories] (`sac/show-all-categories`)
# c. [Entire description] (`pd/pkg-descr`)
# d. [Package content] (`pc/pkg-content`)
# e. [Which package provides this program] (`prov/provides`)
# f. [Which package requires this library] (`req/requires`)
# g. [Show direct dependencies] (`sd/show-deps`)
# h. [Show all dependencies] (`sfd/show-full-deps`)
# i. [Erase cache] (`cl/clean`)
###DEV###
echo '#!/bin/sh
#...' > /tmp/dev-neetpkg.sh
chmod +x /tmp/neetpkg.sh
ls -l /tmp/neetpkg-sh
rm /tmp/dev-neetpkg-sh
###DEV###
echo 'Great, neetpkg is now installed!'
echo 'NEETBSD installation finished. Enjoy!'