Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Latest commit ea0d13c Sep 1, 2016 History
1 contributor

Users who have contributed to this file

executable file 90 lines (71 sloc) 2.22 KB
#!/usr/bin/bash -x
pack=(xorg-xinit xorg-server xorg-server-utils xterm xf86-video-fbdev xf86-input-evdev xf86-input-mouse xf86-input-keyboard ttf-dejavu gnu-free-fonts xorg-fonts-75dpi firefox openbox unclutter )
user=monitor
######################## FUNCTION
function usage {
if [ "$1" == "" ]; then
echo "$0 braucht eine URL!"
return 1
fi
return 0
}
function install_PKG {
local PKG=$1
pacman -Qs ${PKG}
if [ $? == 1 ]; then
pacman --noconfirm -S ${PKG}
if [ $? != 0 ]; then
EXIT "pacman -S ${PKG} failed $?"
fi
fi
}
function write_file {
local TEXT=$1
local FILE=$2
if [ -e ${FILE} ]; then
echo ${TEXT} >> ${FILE}
else
echo ${TEXT} > ${FILE}
fi
}
function failed {
local fin=$1
if [ ${fin} == 1 ]; then
EXIT "Command failed\n"
fi
}
########################## INSTALL
systemctl daemon-reload
usage $1
if [ $? = 1 ]; then
echo "Geben Sie eine vollstaendige URL ein(Bsp: http://www.bla.blub): "
read HTTP
else
HTTP=$1
fi
for value in ${pack[*]}
do
install_PKG ${value}
systemctl daemon-reexec
done
############################# CONFIG
useradd -mp ${user} ${user}
write_file 'PermitRootLogin yes' /etc/ssh/sshd_config
write_file '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx' /home/${user}/.bash_profile
write_file '#!/bin/bash' /home/${user}/.xinitrc
write_file '/usr/bin/openbox &' /home/${user}/.xinitrc
write_file 'xset s off' /home/${user}/.xinitrc
write_file 'xset -dpms' /home/${user}/.xinitrc
write_file 'xset s noblank' /home/${user}/.xinitrc
write_file 'unclutter -idle 1 -jitter 2 -root &' /home/${user}/.xinitrc
write_file "/home/${user}/start-firefox.sh" /home/${user}/.xinitrc
write_file '#!/bin/bash' /home/${user}/start-firefox.sh
write_file "rm -rf /home/${user}/rpiPresent" /home/${user}/start-firefox.sh
write_file "cp -a /home/${user}/rpiPresent.template /home/${user}/rpiPresent" /home/${user}/start-firefox.sh
write_file "/usr/bin/firefox --profile /home/${user}/rpiPresent ${HTTP}" /home/${user}/start-firefox.sh
mv ${HOME}/Firefox/rpiPresent.template /home/${user}/
mv ${HOME}/Firefox/getty@tty1.service.d /etc/systemd/system
systemctl enable getty@tty1
chmod a+x /home/${user}/.xinitrc /home/${user}/start-firefox.sh
chown -R ${user}:${user} /home/${user}/
shutdown -r now