# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # sysutils/mkdesktop # sysutils/mkdesktop/Makefile # sysutils/mkdesktop/files # sysutils/mkdesktop/files/mkdesktop # sysutils/mkdesktop/files/mkdesktop.1.gz # sysutils/mkdesktop/files/stage-definitions # sysutils/mkdesktop/pkg-descr # sysutils/mkdesktop/distinfo # echo c - sysutils/mkdesktop mkdir -p sysutils/mkdesktop > /dev/null 2>&1 echo x - sysutils/mkdesktop/Makefile sed 's/^X//' >sysutils/mkdesktop/Makefile << 'edba6822508738a659ff469244f1df7a' X# $FreeBSD$ X XPORTNAME=mkdesktop XPORTVERSION=2.0 XCATEGORIES=sysutils XMASTER_SITES= X XMAINTAINER=bourne.identity@hotmail.com XCOMMENT=Powerful, flexible utility to setup a FreeBSD desktop X XNO_BUILD=yes XNO_ARCH=yes X XPLIST_FILES=bin/${PORTNAME} share/${PORTNAME}/${PORTNAME} share/${PORTNAME}/stage-definitions man/man1/mkdesktop.1.gz X Xdo-install: X ${INSTALL_SCRIPT} ${WRKDIR}/mkdesktop ${STAGEDIR}${PREFIX}/bin/ X ${MKDIR} ${STAGEDIR}${PREFIX}/share/${PORTNAME} X ${INSTALL_DATA} ${WRKDIR}/mkdesktop ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ X ${INSTALL_DATA} ${WRKDIR}/stage-definitions ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ X ${INSTALL_MAN} ${WRKDIR}/mkdesktop.1.gz ${STAGEDIR}${MANPREFIX}/man/man1 X X.include edba6822508738a659ff469244f1df7a echo c - sysutils/mkdesktop/files mkdir -p sysutils/mkdesktop/files > /dev/null 2>&1 echo x - sysutils/mkdesktop/files/mkdesktop sed 's/^X//' >sysutils/mkdesktop/files/mkdesktop << '496c47bc51067545d7766a2edc7f9cd6' X#!/bin/sh X Xsz_usage="I need 0 (zero) mandatory args : `basename $0` [optional arguments] X XLegend of [optional arguments] :: X X--begin : Use as the beginning stage X( X defaults to 1. But you can specify a higher value as long as it is lower X than or equal to end. You can also specify a begin value of 0 - stage 0 runs X a special initialization procedure to set up your graphics subsystem X) X X--end : Use as the last stage to process X( X defaults to the highest stage value available, as evaluated at runtime. But X you can change that to something lower, as long as it is at least equal to X the begin value X) X X--pkg_list_dir : Use as the package list directory X(defaults to \$HOME/mkdesktop/pkg_list) X X--no-postproc : Disable the postproc function that kicks in automatically upon Xprocessing of regular stages to configure emulation layers and system files X X--dry : in dry mode, special functions (stage 0; post-processor) are Xdisabled and regular stage levels are processed by 'pkg install --dry-run', Xunless you specify --echo too (in which case the --dry argument is silently Xignored). --dry is available to non-root users too. X X--echo : in echo mode, special functions (stage 0; post-processor) are Xdisabled and regular stage levels are processed by 'echo', not 'pkg install'. X--echo takes precedence over --dry, as well as is available to non-root users Xtoo. This is useful for testing what non-automatic packages would get installed Xby this script. X X--append : in append mode, packages mentioned in package list files are Xappended to the stage definition lists, which otherwise would be superseded. X X--help : print an introductory message. X X--usage : print usage information" X Xlocation=$HOME/mkdesktop Xpkg_list_dir="$location/pkg_list" Xno_postproc=false X Xmode_echo=false Xmode_dry=false Xmode_append=false Xmode_yes=false X Xbegin=1 Xend=-1 X Xarg_begin=false Xarg_end=false X Xdummy=0 X Xdie() X{ X [ $# -eq 0 ] && exit 1 X X [ $# -gt 1 ] && \ X echo "error initiated at line $1 : X $2" 1>&2 || \ X echo "$1" 1>&2 X X exit 1 X} X Xwhile echo "$1" | grep '^--' > /dev/null; do X case "$1" in X --begin) X shift X begin="" X X if [ $# -gt 0 ]; then X if echo $1 | grep '[^[:digit:]]' > /dev/null; then X die "$LINENO" "Bad digital value for begin : $1" X else X begin="$1" X arg_begin=true X shift X fi X fi X ;; X X --end) X shift X end="" X X if [ $# -gt 0 ]; then X if echo $1 | grep '[^[:digit:]]' > /dev/null; then X die "$LINENO" "Bad digital value for end : $1" X else X end="$1" X arg_end=true X shift X fi X fi X ;; X X --pkg_list_dir) X shift X pkg_list_dir="" X X if [ $# -gt 0 ]; then X pkg_list_dir="$1" X shift X fi X ;; X X --no-postproc) X shift X no_postproc=true X ;; X X --dry) X shift X mode_dry=true X ;; X X --echo) X shift X mode_echo=true X ;; X X --append) X shift X mode_append=true X ;; X X --help) X less /usr/ports/sysutils/mkdesktop/pkg-descr X exit $? X ;; X X --usage) X echo "$sz_usage" X exit 0 X ;; X X *) X die "$LINENO" "Invalid optional arg : $1" X ;; X esac Xdone X X[ $# -eq 0 ] || { die "$sz_usage"; } X Xstage=0 Xidents="" X Xfor var in location pkg_list_dir; do X eval val='$'$var X [ -z "$val" ] && die "$LINENO" "Empty string for $var" Xdone X Xif ! [ -d "$location" ]; then X cat <<-EOF X This seems to be the first time you are running mkdesktop. X X I can help you with the initial layout for running mkdesktop smoothly. X X If you wish, I can : X X 1) create the directory $HOME/mkdesktop X (which hosts the stage-definitions file) X X 2) create a default $HOME/mkdesktop/stage-definitions X (which should be good enough to get you started) X X Of course, you can always create the above by hand. And you can always X customize your stage-definitions file. You are encouraged to at least read X your stage-definitions file ($HOME/mkdesktop/stage-definitions), just to get X a feel of what lies therein, and perhaps define a custom stage too, so that X you becomes familiar with mkdesktop's working and ensure that everything X works seamlessly end-to-end for you. If you mess up your stage-definitions X file, no probs : just copy out afresh from /usr/local/share/mkdesktop/ X X If you later decide to boost your setup with package list files (read the X manpage for more on this), put them under the directory X $HOME/mkdesktop/pkg_list (which too I will create right now; or else, you X can create yourself later). X X What would you like me to do ? X X I) Initialize the setup X S) Skip initialization X X Press Control-C if you wish to abort. X X Your choice ? (I/S) : X EOF X X read answer X X case "$answer" in X i|I) X set -e X mkdir $HOME/mkdesktop X cp /usr/local/share/mkdesktop/stage-definitions $HOME/mkdesktop/stage-definitions X mkdir $HOME/mkdesktop/pkg_list X X cat <<-EOF X X mkdesktop has been initialized. X X If you wish to alter the stage-definitions or package list files for X this run, you can do still do it from another terminal window. X X When ready, press Enter to continue (or Control-C to abort) X EOF X X read enter X set +e X ;; X X s|S) X ;; X X *) X echo "I could not make sense of your choice : - (" 1>&2 X exit 1 X ;; X esac Xfi X X[ -f "$location"/stage-definitions ] && \ X{ . "$location"/stage-definitions; } || \ X{ echo "Warning : $location/stage-definitions does not exist" 1>&2; } X Xfor var in begin end; do X eval val='$'$var X X [ $var = end ] && [ "$val" = "-1" ] && val=0 X [ -z "$val" ] && die "$LINENO" "Empty string for $var" X X echo "$val" | grep '[^[:digit:]]' > /dev/null && \ X die "$LINENO" "Bad digital value ($var) : ${val}" Xdone X X[ $end -gt $stage ] && \ Xdie "$LINENO" "end must not be greater than the highest stage value ($stage)" X X[ $end -lt 0 ] && end=$stage X Xif [ $begin -gt $end ]; then X [ $end -eq 0 ] && echo "Have you defined at least one stage ?" 1>&2 X die "$LINENO" "begin must not be greater than end" Xfi X Xif [ "$mode_echo" = "false" -a "$mode_dry" = "false" ]; then X dummy=`expr $dummy + 1` X X [ `id -u` -eq 0 ] || die "You need to be root to execute this script" Xfi X Xf_stagezero() X{ X if [ "$mode_echo" = "false" -a "$mode_dry" = "false" ]; then X cat <<-EOF X X This special stage has only one thing to do : X setup any needed kld's for your graphics chipset X X Continue ? (y/n) : X EOF X X read answer X X case "$answer" in X y|Y) X cat <<-EOF X X What is your graphics chipset : X X 1) radeon [ needs radeon.ko; radeonkms.ko : X both shipped by FreeBSD in the base distribution ] X X 2) nvidia [ needs nvidia.ko; nvidia-modeset.ko : X both intalled via nvidia-driver ] X X 3) other [ needs nothing/something I am not aware of ] X X Your choice ? (1/2/3) : X EOF X X read answer X X case "$answer" in X 1) X for k in radeon radeonkms; do X echo "kldstat -qn $k || kldload $k" >> /etc/rc.local X done X X return $? X ;; X X 2) X pkg install nvidia-driver X X [ $? -eq 0 ] || die "$LINENO" "nvidia-driver install failed" X X for k in nvidia nvidia-modeset; do X echo "kldstat -qn $k || kldload $k" >> /etc/rc.local X done X X return $? X ;; X X 3) X return 0 X ;; X X *) X echo "I do not know what to make of that : - (" 1>&2 X return 1 X ;; X X esac X ;; X X n|N) X ;; X X *) X echo "I do not know what to make of that : - (" 1>&2 X return 1 X ;; X esac X fi X} X Xfix_noeol() X{ X [ $# -gt 0 ] || { echo "missing mandatory arg : " 1>&2; return 1; } X [ -f "$1" ] || { echo "$1 is not a regular file" 1>&2; return 1; } X X local r=0 X local f="$1" X X if file "$f" | grep '\' > /dev/null; then X local last="`tail -c1 \"$f\"`" X X if [ -n "$last" ]; then X [ -w "$f" ] || { echo "$f is not writable" 1>&2; return 1; } X X echo >> "$f" X r=$? X fi X fi X X return $r X} X Xf_stage() X{ X [ $# -ne 1 ] && \ X { echo "f_stage() :: I need 1 arg : stage name (ident)" 1>&2; return 1; } X X [ -z "$1" ] && \ X { echo "f_stage() :: I need 1 arg : stage name (ident)" 1>&2; return 1; } X X if ! echo "$idents" | grep -w "$1" > /dev/null; then X echo "f_stage() :: I could not locate $1 among the definitions" 1>&2 X return 1 X fi X X echo -e "\e[4m${1}\e[0m :: \c" X X local nextline="" X local firstchar="" X local lines=0 X local index=0 X X local file="" X eval local arg='$'list_${1} X X local list="`echo $arg | sed 's/:/ /g'`" X X [ -f "$pkg_list_dir"/"$1" ] && file="$pkg_list_dir"/"$1" X X if [ -n "$file" ]; then X fix_noeol "$file" X X [ "$mode_append" = "false" ] && list="" X lines="`cat $file | wc -l | sed 's/^[[:space:]]*//'`" X index=1 X X while [ $index -le $lines ]; do X nextline="`sed -n ${index}p $file`" X X if [ -n "$nextline" ]; then X firstchar="`echo $nextline | cut -c1`" X X if [ "$firstchar" = '#' ]; then X dummy=`expr $dummy + 1` X else X [ -z "$list" ] && list="$nextline" || list="$list $nextline" X fi X fi X X index=`expr $index + 1` X done X fi X X local cmd="pkg install" X X [ "$mode_dry" = "true" ] && \ X { cmd="$cmd --dry-run"; } || \ X { [ "$mode_yes" = "true" ] && cmd="$cmd --yes"; } X X [ "$mode_echo" = true ] && cmd="echo" X X [ -z "$list" ] && echo || { $cmd $list; } X local r=$? X X [ "$mode_dry" = "true" ] && [ $r -eq 1 ] && r=0 X return $r X} X X[ $begin -gt 0 ] || f_stagezero X[ $? -eq 0 ] || die "$LINENO" "stage failure setting up graphics subsystem" X[ $end -eq 0 ] && exit 0 X Xpostproc() X{ X [ "$mode_dry" = "true" ] && return 0 X [ "$mode_echo" = "true" ] && return 0 X [ "$no_postproc" = "true" ] && return 0 X X cat <<-EOF X X Your desktop has been successfully installed : - ) X X I am now going to start post-install processing to set up the following : X X Wine (32-bit/64-bit Windows emulation layer, user-space) X Linuxulator (64-bit Linux emulation layer, kernel-space) X X System files : X /etc/fstab X /etc/devfs.conf X /etc/devfs.rules X /etc/rc.conf X /etc/sysctl.conf X /boot/loader.conf X X I will seek permission from you for each of the above individually : - ) X X Note : If you ask me to configure system files, existing originals will be X saved with .bak extension X EOF X X b_valid=false X X while [ "$b_valid" = "false" ]; do X cat <<-EOF X X Would you like me to kick off post-processing ? X X y) Do it X n) Cancel this [and exit immediately] X X Your choice ? (y/n) : X EOF X X read answer X X case "$answer" in X y|Y) X b_valid=true X ;; X X n|N) X b_valid=true X exit 0 X ;; X X *) X echo "I do not know what to make of that : - (" 1>&2 X ;; X esac X done X X readonly UNITY=1 X readonly WIN32=$(( UNITY<<1 )) X readonly WIN64=$(( UNITY<<2 )) X readonly LINUX=$(( UNITY<<3 )) X X clear && echo "Beginning postproc" X X EMU=0 X X echo && echo "Would you like me to set up Wine (Windows emulation layer) ?" X echo && echo "y/n :" X read answer X X case "$answer" in X y|Y) X cat <<-EOF X X Choose a mode : X X 1) 32-bit X 2) 64-bit (This won't work if your system's CPU is 32-bit) X c) cancel Wine X EOF X X read answer X X case "$answer" in X 1) X EMU=$(( EMU | UNITY | WIN32 )) X ;; X X 2) X EMU=$(( EMU | UNITY | WIN64 )) X ;; X X c|C) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping Wine" X ;; X esac X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping Wine" X ;; X esac X X echo && echo "Would you like me to set up Linuxulator (Linux emulation layer) ?" X echo && echo "Note : if you choose y, I will factor the Linuxulator into subsequent processing" X echo && echo "y/n :" X X read answer X X case "$answer" in X y|Y) X EMU=$(( EMU | UNITY | LINUX )) X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping Linuxulator" X ;; X esac X X my_emu=$(( EMU & UNITY )) X X result_win32=1 X result_win64=1 X result_linux=1 X X if [ $my_emu -ne 0 ]; then X my_emu=$(( EMU & WIN32 )) X X if [ $my_emu -ne 0 ]; then X pkg install --yes i386-wine wine-mono wine-gecko X result_win32=$? X fi X X my_emu=$(( EMU & WIN64 )) X X if [ $my_emu -ne 0 ]; then X pkg install --yes wine wine-mono wine-gecko X result_win64=$? X fi X X my_emu=$(( EMU & LINUX )) X X if [ $my_emu -ne 0 ]; then X if ! kldstat -q -n linux; then X kldload linux X X [ $? -eq 0 ] || \ X die "$LINENO" "Unable to kldload linux" X fi X X if [ "`uname -m`" = "amd64" ]; then X if ! kldstat -q -n linux64; then X kldload linux64 X X [ $? -eq 0 ] || \ X die "$LINENO" "Unable to kldload linux64" X fi X fi X X pkg install --yes linux_base-c7 X result_linux=$? X fi X fi X X flavour_linux=false X X if [ $(( EMU & LINUX )) -ne 0 ]; then X if [ $result_linux -eq 0 ]; then X flavour_linux=true X fi X fi X X set -e X X #block for /etc/fstab X { X f=/etc/fstab X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X if [ "$flavour_linux" = "false" ]; then X eval mandatory${mangled}="\"\ Xfdescfs /dev/fd fdescfs rw 0 0 Xprocfs /proc procfs rw 0 0\"" X X eval hint${mangled}="\"\ XIf you are going to use the Linuxulator to run Linux applications under XFreeBSD natively, try this/these in $f once you have setup the Linuxulator X(most easily done in a single command with 'pkg install linux-sublime3') :\"" X X eval suggested${mangled}="\"\ Xtmpfs /compat/linux/dev/shm tmpfs rw,mode=1777,size=1g 0 0 Xlinprocfs /compat/linux/proc linprocfs rw 0 0 Xlinsysfs /compat/linux/sys linsysfs rw 0 0\"" X else X eval mandatory${mangled}="\"\ Xfdescfs /dev/fd fdescfs rw 0 0 Xprocfs /proc procfs rw 0 0 Xtmpfs /compat/linux/dev/shm tmpfs rw,mode=1777,size=1g 0 0 Xlinprocfs /compat/linux/proc linprocfs rw 0 0 Xlinsysfs /compat/linux/sys linsysfs rw 0 0\"" X X eval hint${mangled}="" X eval suggested${mangled}="" X fi X } X X #block for /etc/devfs.conf X { X f=/etc/devfs.conf X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X if [ "$flavour_linux" = "false" ]; then X eval mandatory${mangled}="\"\ Xown /dev/pci root:operator Xperm /dev/pci 0664 Xown /dev/dri/card0 root:operator Xperm /dev/dri/card0 0664 Xown /dev/pass0 root:operator Xperm /dev/pass0 0664 Xown /dev/cd0 root:operator Xperm /dev/cd0 0664 Xown /dev/xpt0 root:operator Xperm /dev/xpt0 0664\"" X X eval hint${mangled}="\"\ XIf you're going to use the Linuxulator to run Linux applications under XFreeBSD natively, try this/these in $f once you have setup the Linuxulator X(most easily done in a single command with 'pkg install linux-sublime3') :\"" X X eval suggested${mangled}="\"\ Xlink /compat/linux/dev/shm shm\"" X else X eval mandatory${mangled}="\"\ Xown /dev/pci root:operator Xperm /dev/pci 0664 Xown /dev/dri/card0 root:operator Xperm /dev/dri/card0 0664 Xown /dev/pass0 root:operator Xperm /dev/pass0 0664 Xown /dev/cd0 root:operator Xperm /dev/cd0 0664 Xown /dev/xpt0 root:operator Xperm /dev/xpt0 0664 Xlink /compat/linux/dev/shm shm\"" X X eval hint${mangled}="" X eval suggested${mangled}="" X fi X } X X #block for /etc/devfs.rules X { X f=/etc/devfs.rules X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X eval mandatory${mangled}="\"\ X[system=10] Xadd path 'usb/*' mode 0664 group operator Xadd path 'cd*' mode 0664 group operator Xadd path 'da*' mode 0664 group operator Xadd path 'video*' mode 0664 group operator\"" X X eval hint${mangled}="" X eval suggested${mangled}="" X } X X #block for /etc/rc.conf X { X f=/etc/rc.conf X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X if [ "$flavour_linux" = "false" ]; then X eval mandatory${mangled}="\"\ Xdevfs_system_ruleset=system Xdbus_enable=YES Xhald_enable=YES Xcupsd_enable=YES\"" X X eval hint${mangled}="\"\ XHere's a few more goodies for you to keep in mind for ${f} : X X1) For fuse to be able to mount non-native filesystems like ntfs/ext4 X2) For a decent typing speed on the console X3) For auto-loading linux.ko\"" X X eval suggested${mangled}="\"\ Xfusefs_enable=YES Xkeyrate=fast Xlinux_enable=YES\"" X else X eval mandatory${mangled}="\"\ Xdevfs_system_ruleset=system Xdbus_enable=YES Xhald_enable=YES Xlinux_enable=YES Xcupsd_enable=YES\"" X X eval hint${mangled}="\"\ XHere's a few more goodies for you to keep in mind for ${f} : X X1) For fuse to be able to mount non-native filesystems like ntfs/ext4 X2) For a decent typing speed on the console\"" X X eval suggested${mangled}="\"\ Xfusefs_enable=YES Xkeyrate=fast\"" X fi X } X X #block for /etc/sysctl.conf X { X f=/etc/sysctl.conf X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X if [ "$flavour_linux" = "false" ]; then X eval mandatory${mangled}="" X X eval hint${mangled}="\"\ XYou might like to keep in mind a few other suggestions for ${f}, all optional. X1 goodie to let normal users mount disks and 2 Linuxulator goodies :\"" X X eval suggested${mangled}="\"\ Xvfs.usermount=1 Xcompat.linux.osrelease=2.6.18 Xkern.ipc.shm_allow_removed=1\"" X else X eval mandatory${mangled}="\"\ Xcompat.linux.osrelease=2.6.18 Xkern.ipc.shm_allow_removed=1\"" X X eval hint${mangled}="\"\ XFor $f, keep in mind a tip to let normal users mount disks :\"" X X eval suggested${mangled}="\"\ Xvfs.usermount=1\"" X fi X } X X #block for /boot/loader.conf X { X f=/boot/loader.conf X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X X eval mandatory${mangled}="\"\ Xkern.vty=vt\"" X X eval hint${mangled}="" X eval suggested${mangled}="" X } X X for f in /etc/fstab; do X echo && echo "Configure $f : (y/n) ?" X read answer X X case "$answer" in X y|Y) X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X eval mandatory='$'mandatory${mangled} X X if [ -f $f ]; then X if [ -n "$mandatory" ]; then X cp $f $f.bak X X maxlines=`echo "$mandatory" | wc -l | sed 's|^[[:space:]]*||'` X index=1 X X while [ $index -le $maxlines ]; do X line="`echo \"$mandatory\" | sed -n ${index}p`" X token1=`echo $line | awk '{print $1}'` X X if ! cat $f | grep --silent "^$token1[[:space:]]"; then X echo $line >> $f X fi X X index=`expr $index + 1` X done X fi X else X echo "$mandatory" > $f X fi X X echo && echo "Done configuring $f" X eval hint='$'hint${mangled} X eval suggested='$'suggested${mangled} X X if [ -n "$suggested" ]; then X echo "$hint" X echo && echo "$suggested" X fi X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping $f" X ;; X esac X done X X for f in /etc/devfs.conf; do X echo && echo "Configure $f : (y/n) ?" X read answer X X case "$answer" in X y|Y) X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X eval mandatory='$'mandatory${mangled} X X if [ -f $f ]; then X if [ -n "$mandatory" ]; then X cp $f $f.bak X X maxlines=`echo "$mandatory" | wc -l | sed 's|^[[:space:]]*||'` X index=1 X X while [ $index -le $maxlines ]; do X line="`echo \"$mandatory\" | sed -n ${index}p`" X X if ! cat $f | grep --silent "$line"; then X token1=`echo $line | awk '{print $1}'` X token3=`echo $line | awk '{print $3}'` X X token2=`echo $line | awk '{print $2}'` X token2_alt=`echo $token2 | sed -n 's|^/dev/||p'` X t2_lastchar=`echo $token2 | rev | cut -c1` X X search="^${token1}[[:space:]]+${token2}[[:space:]]" X X if [ -n "$token2_alt" ]; then X search="^${token1}[[:space:]]+(${token2}|${token2_alt})[[:space:]]" X fi X X if [ "$t2_lastchar" = "0" ]; then X lead=`echo $token2 | sed -n 's|^\(.*[^[:digit:]]\)\([[:digit:]]*\)$|\1|p'` X trail=`echo $token2 | sed -n 's|^\(.*[^[:digit:]]\)\([[:digit:]]*\)$|\2|p'` X X while [ -c $token2 ]; do X if ! cat $f | egrep --silent "$search"; then X echo $line >> $f X fi X X trail=`expr $trail + 1` X token2="${lead}${trail}" X token2_alt=`echo $token2 | sed -n 's|^/dev/||p'` X line="$token1 $token2 $token3" X X search="^${token1}[[:space:]]+${token2}[[:space:]]" X X if [ -n "$token2_alt" ]; then X search="^${token1}[[:space:]]+(${token2}|${token2_alt})[[:space:]]" X fi X done X else X if [ -c $token2 ]; then X if ! cat $f | egrep --silent "$search"; then X echo $line >> $f X fi X fi X fi X fi X X index=`expr $index + 1` X done X fi X else X echo "$mandatory" > $f X fi X X echo && echo "Done configuring $f" X eval hint='$'hint${mangled} X eval suggested='$'suggested${mangled} X X if [ -n "$suggested" ]; then X echo "$hint" X echo && echo "$suggested" X fi X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping $f" X ;; X esac X done X X for f in /etc/devfs.rules; do X echo && echo "Configure $f : (y/n) ?" X read answer X X case "$answer" in X y|Y) X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X eval mandatory='$'mandatory${mangled} X X if [ -f $f ]; then X if [ -n "$mandatory" ]; then X cp $f $f.bak X X line="`echo \"$mandatory\" | sed -n 1p`" X X if ! cat $f | grep --silent "$line"; then X echo "$mandatory" >> $f X fi X fi X else X echo "$mandatory" > $f X fi X X echo && echo "Done configuring $f" X eval hint='$'hint${mangled} X eval suggested='$'suggested${mangled} X X if [ -n "$suggested" ]; then X echo "$hint" X echo && echo "$suggested" X fi X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping $f" X ;; X esac X done X X for f in /etc/rc.conf /etc/sysctl.conf /boot/loader.conf; do X echo && echo "Configure $f : (y/n) ?" X read answer X X case "$answer" in X y|Y) X mangled=`echo $f | sed 's|[^[:alpha:]]|_|g'` X eval mandatory='$'mandatory${mangled} X X if [ -f $f ]; then X if [ -n "$mandatory" ]; then X cp $f $f.bak X X maxlines=`echo "$mandatory" | wc -l | sed 's|^[[:space:]]*||'` X index=1 X X while [ $index -le $maxlines ]; do X line="`echo \"$mandatory\" | sed -n ${index}p`" X X if ! cat $f | grep --silent "$line"; then X token1=`echo $line | awk -F= '{print $1}'` X token2=`echo $line | awk -F= '{print $2}'` X X search="^${token1}=" X X if ! cat $f | egrep --silent "$search"; then X echo $line >> $f X fi X fi X X index=`expr $index + 1` X done X fi X else X echo "$mandatory" > $f X fi X X echo && echo "Done configuring $f" X eval hint='$'hint${mangled} X eval suggested='$'suggested${mangled} X X if [ -n "$suggested" ]; then X echo "$hint" X echo && echo "$suggested" X fi X ;; X X n|N) X ;; X X *) X echo "I do not know what that means : - (" X echo "Skipping $f" X ;; X esac X done X X set +e X echo X X cat <<-EOF X Post-processing done. X If you saw no errors anywhere, your box is raring to go : - ) X A reboot is now needed - you will need to do that yourself. X X Before you reboot, please make a note of one setting that could save you X hours of googling and jostling later on. X X If you plug in a USB device, it usually will be visible to every user X out-of-the-box. But sometimes, it may happen that only the root user is able X to see the device (most commonly happens with printer/scanner). X X If that happens, run usbconfig as root to ensure that the device is showing X up in the output, and make a note of its ugen ID, with . translating X as ..0 (for example, ugen2.4 would correspond to the ugen ID 2.4.0) X X Then run usbconfig again, this time as the normal user. If the ugen ID is X missing, add a line to /etc/devfs.conf (as root, of course) : X X perm usb/ 0664 X X For our example, that would mean : X X perm usb/2.4.0 0664 X X Then, as root, run '/etc/rc.d/devfs restart'. X Your device should now work cleanly for the normal user too. X EOF X} X Xif [ -n "$idents" ]; then X if [ "$mode_echo" = "false" -a "$mode_dry" = "false" ]; then X clear && echo "Here is a preview of what I shall be doing" X echo X echo -e "(\e[4mstage name\e[0m :: package list as per stage definition)" X echo X echo "<<<<----" X echo X X readonly my_mode_echo=$mode_echo X mode_echo=true X previous_level=0 X X for var in $idents; do X eval level='$'$var X X [ -z "$level" ] && \ X die "$LINENO" "level must not evaluate as an empty string" X X echo "$level" | grep '[^[:digit:]]' > /dev/null && \ X die "$LINENO" "level must be numeric" X X if [ $level -le $previous_level ]; then X die "$LINENO" \ X"This level is ${level}; Previous was ${previous_level} XRandom/descending order of stages is not supported" X fi X X [ $begin -gt $level ] || f_stage $var X X [ $? -eq 0 ] && \ X previous_level=$level || \ X die "$LINENO" "stage failure for stage $var" X X [ $end -eq $level ] && { break; } X done X X echo X echo "---->>>>" X echo X X mode_echo=$my_mode_echo X b_valid=false X X while [ "$b_valid" = "false" ]; do X cat <<-EOF X If you like the preview of what is to be done, give me a : X X y) Install the stages X X Y) Install stages non-interactively : passes --yes to 'pkg install' X (If you enter Y, just wait a few minutes/hours, and your entire X desktop will get assembled nicely and I shall bother you only for X the post-processing when the desktop has been put together) X X If you would like to modify the installation, press Control-C to X abort and alter the stage-definitions file and/or package list files X X Your choice ? (y/Y) : X EOF X X read answer X X case "$answer" in X y) X b_valid=true X ;; X X Y) X b_valid=true X mode_yes=true X ;; X X *) X echo "I do not know what to make of that : - (" 1>&2 X ;; X esac X done X fi X X previous_level=0 X X for var in $idents; do X eval level='$'$var X X [ -z "$level" ] && \ X die "$LINENO" "level must not evaluate as an empty string" X X echo "$level" | grep '[^[:digit:]]' > /dev/null && \ X die "$LINENO" "level must be numeric" X X if [ $level -le $previous_level ]; then X die "$LINENO" \ X"This level is ${level}; Previous was ${previous_level} XRandom/descending order of stages is not supported" X fi X X [ $begin -gt $level ] || f_stage $var X X [ $? -eq 0 ] && \ X previous_level=$level || \ X die "$LINENO" "stage failure for stage $var" X X if [ $end -eq $level ]; then X [ "$arg_end" = "true" ] && exit 0 || break X fi X done X X postproc Xfi X Xexit $? 496c47bc51067545d7766a2edc7f9cd6 echo x - sysutils/mkdesktop/files/mkdesktop.1.gz sed 's/^X//' >sysutils/mkdesktop/files/mkdesktop.1.gz << '032f5a2f1e3aad9c559d3e3b0f727e41' X[mkdesktop.1YQo~. =N]Ԩ; X"Iow.!:]͐ۓ IKgf^#;e_UJ{=.gXy]6X\^}-]._]kK% QTkׯdl#kgf3x-VֵZCFĿz}XW?\~ꝸ\˃F|ZJZU4Ձw nՍI֬ڵK!|Orv\Ǘt 6?W'6ek֦!xc- CHju\tV1Fh cL QTre4IjpdHdqK*&uC'YoA㜁|u2:hGc;7YPg6[l@.Fs&lKͻ@nc])U3BG8X1kaҨP8P['1(m>&ċǭ0GC_)*zU#}QOk5~ڀRZ[7lR톶ٰZI\yvG(,x!O;s`V!j~q"FZ(:x )n[Y|cq\y9B6ZJ$%(C,O 5Mx ?+%75oU)Bk>بZ X!"q~%uu 7jhǔ`Rr/RyGuA";U X wd<ٟa0>qH X>P܇P>!!Q$.DHUnM\cP8vn+5Kz C٘<^ y82t"*ɕ)h%%i$SSA8 X$>P6 eoԓD;+'OPa˙_kVҤtS̪w z9/g>t\ v֍ #=U\ǾoM܉SĢڱGֈ p,3הP8"e}9@V*Ur[V bBHIUOdr&J yhvUнR˗XM )_2]ٝ@Q;Q*[ <Ɇ&I yv.;NrӘ XAg Mq.G oۥPI]B"cŴ9r.x.9뭲;Љc;۫@1X~Qֽx4^5:Y.gUR;=FhpVU sSpl3459R8I zd*}J]4@A`<,n%=E)1HJ  G仞|坘]q;U){vsq\U#9c%BѫLJ4,8󙜁ݶx?_u8ق/;NĶ%~$NdFѷj;θ[Jg{ ԝPOW]rE;U|^Fr؝JZ(*P nyb tC.E*T{th%F)T}dXXBJ0雡:Ь6ZL+m|LQ-j9doڻzj:~ 2 [rS*;g,|h/}Ev0hE,g^i 5=sk3lga%HǛuX-ԱMrIaʖ 7QGUtg;b$h r MQ`RaU˝iᩳw>ണ:ܻ]]" 0b+dns~idz$-+tƢ[:d&~P`& #9^9Y6yr$ mFD kQ( ^i)?@T^ª6b|e˃Z⽽[Q%^fY~"Iw˧&>ĺjd%2pY`u4+L#22nd ~\Rqךw/4IS{OȔFKT:)%*1\~9WeuʑIƧ0ȌTr΀p{6qCΉ,ՎZd˥4%.A4U4~Hڢe.'P܂c[o*Kq:egYt tC1_}E:gN=[1QJcChBcN48.E0ƒ֏q}*D'#N4RK& ;a8 X"tp2)3r^<#})Ʃa0EiGfP--.U3_˗]_q*xV|kɝu{ &\ *Kշ(XP?Py4۝N\%X 032f5a2f1e3aad9c559d3e3b0f727e41 echo x - sysutils/mkdesktop/files/stage-definitions sed 's/^X//' >sysutils/mkdesktop/files/stage-definitions << 'c369a7501cc6bfb9bcf400d24fce7967' X# Copy (and uncomment once) the following block to establish a new stage. X# You can copy to any location in this file. X# The markup tags are purely for visual assistance. X X#{ X## X# #the first line establishes the stage name X# #must be copied as well as altered to generate a new name X# #name must be a) unique; and b) alphanumeric (with underscores permitted) X X# ident=my_stage1 X## X X## X# #the following lines must never be altered, so copy them as is X X# [ -z "$ident" ] && die "$ident is null" X X# echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X# if echo "$idents" | grep -w "$ident" > /dev/null; then X# die "stage-definitions :: error compiling stage $ident : X# name clash with a stage name already defined" X# fi X X# [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X X# stage=`expr $stage + 1` X# eval $ident=$stage X## X X## X# #the last line must be copied and optionally altered as a X# #colon-separated list of packages X X# eval list_${ident}="" X## X#} X X{ X #stage definition for pre_x : X ident=pre_x X X [ -z "$ident" ] && die "$ident is null" X X echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X if echo "$idents" | grep -w "$ident" > /dev/null; then X die "stage-definitions :: error compiling stage $ident : X name clash with a stage name already defined" X fi X X [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X stage=`expr $stage + 1` X eval $ident=$stage X X eval list_${ident}="" X} X X{ X #stage definition for x X ident=x X X [ -z "$ident" ] && die "$ident is null" X X echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X if echo "$idents" | grep -w "$ident" > /dev/null; then X die "stage-definitions :: error compiling stage $ident : X name clash with a stage name already defined" X fi X X [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X stage=`expr $stage + 1` X eval $ident=$stage X X eval list_${ident}="xorg" X} X X{ X #stage definition for post_x X ident=post_x X X [ -z "$ident" ] && die "$ident is null" X X echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X if echo "$idents" | grep -w "$ident" > /dev/null; then X die "stage-definitions :: error compiling stage $ident : X name clash with a stage name already defined" X fi X X [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X stage=`expr $stage + 1` X eval $ident=$stage X X eval list_${ident}="" X} X X{ X #stage definition for desktop X ident=desktop X X [ -z "$ident" ] && die "$ident is null" X X echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X if echo "$idents" | grep -w "$ident" > /dev/null; then X die "stage-definitions :: error compiling stage $ident : X name clash with a stage name already defined" X fi X X [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X stage=`expr $stage + 1` X eval $ident=$stage X X eval list_${ident}="kde5" X} X X{ X #stage definition for post_desktop X ident=post_desktop X X [ -z "$ident" ] && die "$ident is null" X X echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident" X X if echo "$idents" | grep -w "$ident" > /dev/null; then X die "stage-definitions :: error compiling stage $ident : X name clash with a stage name already defined" X fi X X [ -z "$idents" ] && idents=$ident || idents="$idents $ident" X stage=`expr $stage + 1` X eval $ident=$stage X X eval list_${ident}="" X} c369a7501cc6bfb9bcf400d24fce7967 echo x - sysutils/mkdesktop/pkg-descr sed 's/^X//' >sysutils/mkdesktop/pkg-descr << 'eadb4c768a4d7806f0e88e42584fbb25' XInstalling a FreeBSD desktop from scratch can be messy : you often Xforget the correct steps/packages. The mkdesktop script helps to Xstandardize the process as much as possible per user, with plenty of Xflexibility as well as modularity. The script sets up X & your desktop, Xconfigures emulation layers (Wine / Linuxulator) if so desired, and Xthen configures the essential system files under /etc and /boot. eadb4c768a4d7806f0e88e42584fbb25 echo x - sysutils/mkdesktop/distinfo sed 's/^X//' >sysutils/mkdesktop/distinfo << 'd57c7226fd79bcea96e64bc4ce6e5056' XSHA256 (mkdesktop-2.0.tar.gz) = 097eaea3b9661b14958933ef8dcbee6be6a440fcfc30a3b8b1e3562b3111ffe9 XSIZE (mkdesktop-2.0.tar.gz) = 11391 d57c7226fd79bcea96e64bc4ce6e5056 exit