Re: /usr/src and /usr/ports not git directories ?

From: Sulev-Madis Silber <freebsd-current-freebsd-org111_at_ketas.si.pri.ee>
Date: Fri, 24 Jan 2025 09:32:13 UTC
longer analysis, of why src would be, imho, still shipped, is here:

so yeah, i hope src and ports don't disappear from releases completely because i have number or cases where that would be good, including offline by accident, offline by design in high security environment, natural disasters, ((global thermo)nuclear) war or just plain old complete software abadonement of whole fbsd project in far future. i hope the last one is only reason. i'll also exclude sci-fi scenarios here

i just peeked into v1.0 iso i found. imagine, there's src!

that src can be still obtained from (our) git, i checked, but what if it suddenly can't

it's probably not the first time when everyone thought to have piece of software / code until noone had it anymore. if you sprinkle the src around the world like this, there are much less chance it completely disappearing

for a fun, i also have kept my stash of distfiles of last 10+ years or total 23y of using fbsd. it's only 50g of packed sources and includes most of server and desktop things. distcache exists but what if it won't. btw i'm curious how large it is?

there have been whole big tv stations who for intentional or unintentional reasons lost their archive and had to resort on obtaining it from lucky home taper

remember you don't really need to install the src.txz at all. you can just pkg install git or ports install it and pull it down from network if it's there still

it doesn't seem to save space either and we have minis for it

while there, can we have maxi-memstick too? in addition of hybrid iso. as this could allow quick image modification if one couldn't be arsed to build their own at the time they eg want to quickly sideload something like http://ketas.si.pri.ee/misc/installer-addon-utils-root-bin-si.sh into installer

so i hope end result is just src maybe getting git bootstrap and not getting completely removed

but yeah, it's weird how src is in git but base has no git. somehow we ended up with good tool but with wrong license and now it can't be in base because of it. if basically noone devs, why is compiler in base then? btw removing that would be weird too and would create all sorts of chicken end egg issues

hopefully this all resolves into my favorite solution, still have src/ports


---begin---
#!/bin/sh -Cefu
#
# Copyright (c) 2024  Sulev-Madis Silber <ketas@si.pri.ee>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#


set -Cefu


######################################################################

keymap=ee

wall_cmos_clock=1

timezone=Europe/Tallinn

ping=example.com

ntp_servers='ntp ntp.si.pri.ee'

######################################################################


_mount_unionfs()
{
	local dst="$1"
	
	local src="/tmp/unionfs$dst"
	
	
	if [ ! -d "$src" ]
	then
		mkdir -p "$src"
	fi
	
	
	if [ ! -d "$dst" ]
	then
		mkdir -p "$dst"
	fi
	
	
	if ! mount -t unionfs | fgrep -q "$dst"
	then
		mount_unionfs -o noatime "$src" "$dst"
	fi
}


if [ "$keymap" ]
then
	kbdcontrol -r fast -l "$keymap"
fi


if [ ! -f /tmp/tmp-mount-done ]
then
	echo
	
	
	mount -t tmpfs tmpfs /tmp
	
	
	service cleartmp start
	
	mkdir /tmp/bsdinstall_etc
	
	touch /tmp/bsdinstall_log
	
	
	touch /tmp/tmp-mount-done
fi


for dst in /etc /root /usr/local /var/cache/pkg /var/db/pkg
do
	_mount_unionfs "$dst"
done


if [ "$wall_cmos_clock" ]
then
	if [ ! -f /etc/wall_cmos_clock ]
	then
		touch /etc/wall_cmos_clock
	fi
fi


if [ "$timezone" ]
then
	if [ ! -f /etc/localtime ]
	then
		tzsetup "$timezone"
	fi
fi


if ! pgrep -q adjkerntz
then
	service adjkerntz start
fi


for if in `ifconfig -l`
do
	if [ "$if" = lo0 ]
	then
		continue
	fi
	
	
	ifconfig "$if" inet6 -ifdisabled accept_rtadv up
	
	
	if ! service dhclient status "$if" > /dev/null
	then
		echo
		
		
		service dhclient forcestart "$if"
	fi
done


if ! pgrep -q rtsold
then
	rtsold -am
fi


if [ "$ping" ]
then
	echo
	
	
	for af in 4 6
	do
		if ping "-${af}oq" "$ping" > /dev/null
		then
			echo "v$af ok"
		else
			echo "v$af fail"
		fi
	done
fi


if [ "$ntp_servers" ]
then
	if [ ! -f /tmp/ntpdate-run-done ]
	then
		echo
		
		
		ntpdate $ntp_servers
		
		
		touch /tmp/ntpdate-run-done
	fi
fi


if ! service ntpd onestatus > /dev/null
then
	echo
	
	
	service ntpd onestart
fi


if [ "$ntp_servers" ]
then
	echo
	
	
	if [ -f /tmp/ntpdate-run-done ]
	then
		ntpdate -q $ntp_servers
	fi
fi


echo


date


echo


for kld in coretemp amdtemp
do
	if [ -f "/boot/kernel/$kld.ko" ]
	then
		kldload -n "$kld"
	fi
done


sysctl -a | grep '[0-9]C$' | egrep -v '(_(CRT|PSV)|\.tjmax)'


if sysctl -a | fgrep -q battery
then
	echo
	
	
	acpiconf -i 0 | grep -v ':[[:space:]]*$'
fi


echo

---end---