FreeBSD Bugzilla – Attachment 185481 Details for
Bug 221370
New port : sysutils/mkdesktop (the cool way to setup a FreeBSD desktop)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Updated shar for the new port mkdesktop
mkdesktop.shar (text/plain), 38.47 KB, created by
bourne.identity@hotmail.com
on 2017-08-16 12:14:00 UTC
(
hide
)
Description:
Updated shar for the new port mkdesktop
Filename:
MIME Type:
Creator:
bourne.identity@hotmail.com
Created:
2017-08-16 12:14:00 UTC
Size:
38.47 KB
patch
obsolete
># 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/distinfo ># sysutils/mkdesktop/files ># sysutils/mkdesktop/files/mkdesktop ># sysutils/mkdesktop/files/mkdesktop.help ># sysutils/mkdesktop/files/stage-definitions ># sysutils/mkdesktop/pkg-descr ># >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= 1.0 >XCATEGORIES= sysutils >XMASTER_SITES= >XDISTFILES= >X >XMAINTAINER= bourne.identity@hotmail.com >XCOMMENT= Powerful, flexible utility to setup a FreeBSD desktop >X >XLICENSE= BSD3CLAUSE >X >XRUN_DEPENDS= pkg>0:ports-mgmt/pkg >X >XNO_BUILD= yes >XNO_ARCH= yes >X >XDATA1= stage-definitions >XDATA2= mkdesktop.help >XPLIST_FILES= bin/${PORTNAME} share/${PORTNAME}/${DATA1} share/${PORTNAME}/${DATA2} >X >Xdo-install: >X ${MKDIR} ${STAGEDIR}${PREFIX}/share/${PORTNAME} >X ${INSTALL_DATA} files/${DATA1} ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ >X ${INSTALL_DATA} files/${DATA2} ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ >X ${INSTALL_SCRIPT} files/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ >X >X.include <bsd.port.mk> >edba6822508738a659ff469244f1df7a >echo x - sysutils/mkdesktop/distinfo >sed 's/^X//' >sysutils/mkdesktop/distinfo << 'd57c7226fd79bcea96e64bc4ce6e5056' >XSHA256 (mkdesktop-1.0.tar.gz) = 2b8c00a44db5054f879ede4c52ffb3db164da08645dea1806a6312be00ed801a >XSIZE (mkdesktop-1.0.tar.gz) = 9885 >d57c7226fd79bcea96e64bc4ce6e5056 >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 <level> : Use <level> 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 <level> : Use <level> 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 <dir> : Use <dir> 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 manual >X(this uses \$EDITOR, if set. If not set, rvim or else rjoe or else vi) >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 my_editor="$EDITOR" >X [ -z "$my_editor" ] && [ -x /usr/local/bin/rvim ] && my_editor=/usr/local/bin/rvim >X [ -z "$my_editor" ] && [ -x /usr/local/bin/rjoe ] && my_editor=/usr/local/bin/rjoe >X [ -z "$my_editor" ] && my_editor=vi >X >X "$my_editor" /usr/local/share/mkdesktop/mkdesktop.help >X exit 0 >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 output of --help for this), put them under the directory >X $HOME/mkdesktop/pkg_list (which too I can create right now; or else, you can >X 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 >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 #Since if-fi blocks must not be empty, the line below allows the rest of >X #this block to be commented, if you wish to hack away 'the root cause' : - ) >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 : <file>" 1>&2; return 1; } >X [ -f "$1" ] || { echo "$1 is not a regular file" 1>&2; return 1; } >X >X r=0 >X f="$1" >X >X if file "$f" | grep '\<ASCII text\>' > /dev/null; then >X last="`tail -c1 \"$f\"`" >X >X if [ -n "$last" ]; then >X [ -w "$1" ] || { echo "$1 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 && echo "Starting work on stage : $1" >X >X file="" >X eval arg='$'list_${1} >X 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 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" ] || { $cmd $list; } >X >X r=$? >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 pkg install --yes linux-sublime3 >X r=$? >X >X [ $r -eq 0 ] || >X { >X echo "linux-sublime3 installation failed" 1>&2 >X echo "Retrying the Linuxulator with linux-opera" 1>&2 >X pkg install --yes linux-opera >X } >X >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 0660 group operator >Xadd path 'cd*' mode 0660 group operator >Xadd path 'da*' mode 0660 group operator >Xadd path 'video*' mode 0660 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 $token | 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 <x>.<y> translating >X as <x>.<y>.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/<ugen_ID> 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 echo "Here is a preview of what I shall be doing :" >X echo >X echo "<<<<----" >X echo >X >X 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.help >sed 's/^X//' >sysutils/mkdesktop/files/mkdesktop.help << '7570bff8a0320bda2e48acea153d4918' >XInstalling a FreeBSD desktop from scratch can be messy : you often forget the >Xcorrect steps/packages. This script helps to standardize the process as much as >Xpossible per user, with plenty of flexibility as well as modularity. >X >XAlthough you could lump all packages into a single list, breaking up the list >Xinto more stages allows for better, fine-grained control. >X >XBy default, 5 stages are considered, in order : >X >Xpre_x -> x -> post_x -> desktop -> post_desktop >X >Xpre_x (level 1) presumes there is no X around. The default definition of this >Xstage is empty, but this is a good place to specify command-line utilities - >Xwget:cdrecord:vim-lite >X >Xx (level 2) is the stage for installing the base X system. By default, this >Xinstalls just the xorg meta-distribution. >X >Xpost_x (level 3) is suited for X stuff that is not desktop-specific. The default >Xdefinition of this stage is empty, but you can pull in a lot of stuff - >Xxclip:firefox:virtualbox-ose:libreoffice:smplayer >X >Xdesktop (level 4) is the stage for the base desktop. If you wish to install >XGNOME as the desktop, use gnome3. Or, for a lightweight version, try >Xgnome3-lite. For a lightweight version of KDE4 (which is soon to be phased out >Xwhen KDE5 becomes available under FreeBSD), the list below works as of this >Xmoment and also is the current default - >Xkde-baseapps:kde-runtime:kde-workspace >X >X(Like stage x, the stage definition for desktop should preferably be as lean as >Xpossible). >X >Xpost_desktop (level 5) is where you get the stuff that is desktop-specific. If >Xyou chose gnome3-lite as desktop, you can add some applications at this stage to >Xmake your desktop fuller (though the default setting for this stage is empty) - >Xgnome-terminal:gedit:gdm:file-roller >X >XEach stage can be defined in one/both of the following 2 ways : >X >X1) list_<stage> is a colon-separated list of packages for the stage. As you >Xwould expect, the default implementation has 5 such lists : list_pre_x, list_x, >Xlist_post_x, list_desktop, list_post_desktop. These lists reside in their >Xrespective declarations in the file $HOME/mkdesktop/stage-definitions >X(specifically the line list_$ident=) >X >X2) If a file named <stage> exists in the package list directory, it supersedes >Xthe definition of list_<stage> (unless you use --append). Since the default >Ximplementation is wired for $HOME/mkdesktop/pkg_list as the package list >Xdirectory, this script by default looks for files named pre_x, x, post_x, >Xdesktop and post_desktop therein. You can change the package list directory >Xlocation by passing in "--pkg_list_dir <location>" >X >XIf you create a custom stage named my_stage in the file >X$HOME/mkdesktop/stage-definitions, the script will automatically consider the >Xfile $HOME/mkdesktop/pkg_list/my_stage (if such a file exists) as the stage >Xdefinition. If you do not wish to create a package list file for my_stage, you >Xcan specify the stage's package list by preparing the colon-separated list >Xlist_my_stage in $HOME/mkdesktop/stage-definitions itself (by populating the >Xline list_$ident= in the definition). >X >XUnlike the colon-separated lists, package list files are newline-separated. If >Xthe first character on a line is '#' (hash without quotes), the line is ignored >Xas a comment. >X >XIf you create a file named (for example) mydummy in the package list directory, >Xit comes into consideration only when a stage named mydummy has been declared in >Xthe file $HOME/mkdesktop/stage-definitions. Declaring a custom stage in the file >Xstage-definitions is easy : you just need to copy out the sample at the top to a >Xsuitable location in the file and change the copy's ident string. Make sure the >Xident is unique. >X >Xmkdesktop also bundles in 2 special functions : stagezero and postproc. >X >Xstagezero has to be explicitly invoked by passing in '--begin 0' and it caters >Xto setting up the graphics environment for Radeon/NVidia chipsets, kld's for >Xwhich are set up to be loaded automatically at boot-time via /etc/rc.local. For >XNVidia, stagezero also pulls in the graphics driver nvidia-driver. >X >Xpostproc gets automatically invoked when the regular stages have been processed. >XIt sets up - if the user chooses Yes for each of these - Wine (Windows emulation >Xlayer); Linuxulator (Linux emulation layer); configuration of system files : >X{ >X Under /etc/ : fstab; devfs.conf; devfs.rules; rc.conf; sysctl.conf; >X Under /boot/ : loader.conf; >X} >X >Xmkdesktop never processes standard input; so you cannot use it at the end of a >Xpipeline. Diagnostic messages are always written to standard error. >X >XIf this script makes FreeBSD desktop installation/configuration easier for you, >Xconsider backing up your stage-definitions file and your package list files. Tip >X: it might be a bit painful learning how to use mkdesktop the first time. But if >Xyou regularly install FreeBSD, you will soon appreciate the convenience it >Xbecomes. >X >XIf you [do not] like this script, consider emailing the author : >XManish Jain (bourne.identity@hotmail.com) >7570bff8a0320bda2e48acea153d4918 >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 : the higher up you copy, the >X# earlier that stage will be processed. If you copy to the bottom, it will >X# effectively establish the last stage. >X# >X# The markup tags in the template are purely for visual assistance. >X >X#{ >X##<mustchange> >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##</mustchange> >X >X##<mustnotchange> >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##</mustnotchange> >X >X##<maychange> >X# #the last line must be copied and optionally altered as a >X# #colon-separated list of packages >X >X# eval list_${ident}="" >X##</maychange> >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}="kde-baseapps:kde-runtime:kde-workspace" >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' >Xmkdesktop is a Bourne script that helps to standardize the process of FreeBSD >Xdesktop installation as much as possible per user, with plenty of flexibility as >Xwell as modularity. By default, you get 5 distinct stages for defining your >Xdesktop environment. But you can always add/subtract/customize the stages as >Xmuch as you wish. Once you start using mkdesktop, you will pretty soon love it - >Xparticularly its post-processor which automatically kicks in once the stages >Xhave been processed - it sets up emulation layers and configuration of system >Xfiles, if the user so desires. >eadb4c768a4d7806f0e88e42584fbb25 >exit >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 221370
:
185207
|
185232
|
185289
|
185351
|
185443
|
185448
|
185449
|
185453
|
185481
|
185488
|
185514
|
186298
|
186495
|
186514
|
187213
|
193486