Skip to content

Commit

Permalink
don't assume root partition; cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiwan committed Dec 6, 2023
1 parent 3401f2f commit 5b5196c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions ch1/pkg_install4ubuntu_lkp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ runcmd()
{
[[ $# -eq 0 ]] && return
echo "$@"
eval "$@" || die "failed"
eval "$@" || echo "*** failed ***"
}

#--- 'main'
echo "$(date): beginning installation of required packages..."
# ASSUMPTION! root partition / is on /dev/sda1
spc1=$(df|grep sda1|awk '{print $3}')
echo "Disk space in use currently: ${spc1} KB"

# Get the root partition; we ASSUME you're using it...
ROOT_PART=$(df |grep -w "/"|awk '{print $1}')
[[ -z "${ROOT_PART}" ]] && die "Couldn't get root partition"
spc1=$(df|grep ${ROOT_PART}|awk '{print $3}')
[[ ! -z "${spc1}" ]] && echo "Disk space in use currently: ${spc1} KB"

runcmd sudo apt update
echo "-----------------------------------------------------------------------"
Expand All @@ -57,7 +60,7 @@ runcmd sudo apt install -y \
fakeroot flawfinder \
git gnome-system-monitor gnuplot hwloc indent kmod \
libnuma-dev linux-headers-$(uname -r) linux-tools-$(uname -r) \
man-db net-tools numactl openjdk-18-jre \
man-db net-tools numactl openjdk-22-jdk \
perf-tools-unstable procps psmisc python3-distutils \
rt-tests smem sparse stress stress-ng sysfsutils \
tldr-py trace-cmd tree tuna virt-what yad
Expand All @@ -72,12 +75,13 @@ echo "-----------------------------------------------------------------------"
# libelf-dev elfutils-libelf-devel
#---

# Add yourself to the vboxsf group (to gain access to VirtualBox shared folders);
# will require you to log out and back in (or even reboot) to take effect
# As an aside, lets add ourseleves to the vboxsf group (to gain access to
# VirtualBox shared folders); will require you to log out and back in
# (or even reboot) to take effect
groups |grep -q -w vboxsf || runcmd sudo usermod -G vboxsf -a ${USER}

spc2=$(df|grep sda1|awk '{print $3}')
echo "Difference : ($spc2 - $spc1) : $((spc2-spc1)) KB"

runcmd sudo apt autoremove

spc2=$(df|grep ${ROOT_PART}|awk '{print $3}')
[[ ! -z "${spc1}" && ! -z "${spc2}" ]] && echo "Disk space difference : ($spc2 - $spc1) : $((spc2-spc1)) KB"
exit 0

0 comments on commit 5b5196c

Please sign in to comment.