Skip to content

Instantly share code, notes, and snippets.

@mohd-akram
Created January 29, 2020 13:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohd-akram/6246325b8f2bcdf905f327a6b7f08617 to your computer and use it in GitHub Desktop.
Save mohd-akram/6246325b8f2bcdf905f327a6b7f08617 to your computer and use it in GitHub Desktop.
A script to install VMware tools, xfce and lightdm on a freshly installed FreeBSD system.
#!/bin/sh
username=$1
if [ ! "$username" ]; then
echo usage: $0 username >&2
exit 1
fi
if [ "`id -u`" != 0 ]; then
echo $0: run as root >&2
exit 1
fi
# Prepare pkg
ASSUME_ALWAYS_YES=YES pkg bootstrap
# Install Xorg
pkg install -y xorg
# Install and configure VMware tools
pkg install -y open-vm-tools xf86-video-vmware xf86-input-vmmouse
Xorg -configure
sed '
/Driver[[:blank:]]*"mouse"/s/mouse/vmmouse/
/Driver[[:blank:]]*"vesa"/s/vesa/vmware/
' /root/xorg.conf.new > /usr/local/etc/X11/xorg.conf.d/vmware.conf
rm /root/xorg.conf.new
# Install login manager. Example: lightdm
pkg install -y lightdm lightdm-gtk-greeter
sysrc lightdm_enable=yes
# Install login manager. Example: xdm
# pkg install -y xdm
# echo '/\/usr\/local\/bin\/xdm/s/off/on/ | x' | ex /etc/ttys
# Install desktop environment. Example: xfce
pkg install -y xfce
sysrc dbus_enable=yes
su "$username" <<EOF
ln -s /usr/local/etc/xdg/xfce4/xinitrc ~/.xinitrc # allow using startx
ln -s .xinitrc ~/.xsession # allow using xdm
EOF
echo reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment