Hello everyone,
New here.. but I'll jump right in..
If you have multiple X11 environments with *BSD, this script is very handy. Instead of having a log-in manager (which in some cases takes up a considerable amount of RAM) like XDM, KDM, GDM, etc.
I have tested this on FreeBSD only for now.
It can even play music if you want it to!
Here ya go (tell me what you think please):
--This script currently works with the GNOME and WindowMaker environments.
Code:
#!/usr/local/bin/bash
# You can also modify #!/usr/local/bin/bash to /bin/bash depending on your
# system. This script will allow you to start an environment without
# having to go through a (RAM hogging) log-in manager like XDM, GDM,
# KDM, etc. Enjoy!
clear
echo Choose the environment to start:
OPTIONS="Gnome WindowMaker"
select opt in $OPTIONS; do
if [ "$opt" = "Gnome" ]; then
echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx
exit
elif [ "$opt" = "WindowMaker" ]; then
echo "exec wmaker" > ~/.xinitrc && startx
exit
else
clear
echo Bad Option
fi
done
If you were to want to play music (MUST HAVE mpg123 installed -
/usr/ports/audio/mpg123 on FreeBSD):
Code:
if [ "$opt" = "Gnome" ]; then
echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx && sleep 5 && mpg123 /usr/home/gabe/Gabe_Folders/music/System/startup.mp3
exit
Adjust the sleep <variable> to tell the system how long to wait until playing the music. Also adjust the mpg123 <DIR> to the location of your start up music.
Should be easy enough to follow along. If you have any questions, feel free to ask!
EDIT:
Standard sh script (thanks to
vermaden):
Code:
#! /bin/sh
clear
echo Choose the environment to start:
echo "1. gnome"
echo "2. wmaker"
echo -n "choice: "
read OPT
case $OPT in
(1)
echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx
exit 0
;;
(2)
echo "exec wmaker" > ~/.xinitrc && startx
exit 0
;;
(*)
echo "ERROR: wrong option"
exit 1
;;
esac