Skip to content

Instantly share code, notes, and snippets.

@IslamAlam
Last active May 26, 2019 11:40
Show Gist options
  • Save IslamAlam/9abd0258ea3aec037bcdfca1b5efabce to your computer and use it in GitHub Desktop.
Save IslamAlam/9abd0258ea3aec037bcdfca1b5efabce to your computer and use it in GitHub Desktop.
#!/bin/sh
apt install gnome-panel \
gnome-settings-daemon \
metacity \
nautilus \
gnome-terminal -y
apt install tigervnc-standalone-server \
tigervnc-xorg-extension \
tigervnc-viewer -y
# read -p "Username: " username
#while true;
#do
# read -s -p "Password: " password
# echo
# read -s -p "Password (again): " password2
# echo
# [ "$password" = "$password2" ] && break
# echo "Please try again"
#done
#echo $password
echo 'Please enter the password for VNC Server:'
vncpasswd
FILE="$HOME/.vnc/xstartup"
CHECKDIR=$( dirname "$FILE" )
# The directory with the file must exist
mkdir -p "$CHECKDIR"
if [ ! -f "$FILE" ]; then
# What to do if the file is not there
touch "$FILE"
fi
cat <<'EOF' >$FILE
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[-x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[-r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
EOF
touch $CHECKDIR/xstartup.ubuntu
cat <<'EOF' >$CHECKDIR/xstartup.ubuntu
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[-x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[-r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
EOF
touch $CHECKDIR/xstartup.bak
cat <<'EOF' >$CHECKDIR/xstartup.bak
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[-x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[-r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
EOF
ls -l $CHECKDIR/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment