-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2699c99
commit 2e11542
Showing
1 changed file
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$(whoami)" = "root" ] || [ "$USER" = "root" ]; then | ||
echo 'You need to be a regular user to run this script' | ||
exit 1 | ||
fi | ||
|
||
if [ "$USER" = "" ]; then | ||
USER="$(whoami)" | ||
fi | ||
|
||
kiosk() { | ||
local wl="" | ||
if [ "$(cat ~/.bashrc | grep -F '[archibold.io] weston')" = "" ]; then | ||
echo ' | ||
# [archibold.io] weston | ||
export KIOSK_WIDTH=1280 | ||
export KIOSK_HEIGHT=720 | ||
export COG_PLATFORM_WL_VIEW_FULLSCREEN=1 | ||
export GTK_THEME="Adwaita:dark" | ||
setWestonMode() { | ||
local MODE="$1" | ||
local NAME="" | ||
if [ -f ~/.config/weston.ini ]; then | ||
sed -i "s/name=.*//;s/mode=.*//;/^$/d;s/\[/\n\[/" ~/.config/weston.ini | ||
for NAME in $(ls /sys/class/drm | grep HDMI); do | ||
if [ "$NAME" != "" ]; then | ||
echo "name=${NAME:6}">>~/.config/weston.ini | ||
echo "mode=${MODE}">>~/.config/weston.ini | ||
# prefer one output only | ||
return | ||
fi | ||
done | ||
fi | ||
} | ||
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && [ "$(pgrep --list-name weston)" = "" ]; then | ||
setWestonMode "${KIOSK_WIDTH}x${KIOSK_HEIGHT}" | ||
weston | ||
fi | ||
'>>~/.bashrc | ||
fi | ||
|
||
yes "$1" | su -c " | ||
pacman-key --init | ||
pacman-key --populate archlinuxarm | ||
pacman -Syu | ||
pacman -S --needed --noconfirm weston wpewebkit cpupower | ||
echo 'governor=\"performance\"'>>/etc/default/cpupower | ||
systemctl enable cpupower.service | ||
systemctl start cpupower.service | ||
echo ' | ||
# archibold.io | ||
# dtoverlay=vc4-fkms-v3d,cma-384 | ||
# gpu_mem=128 | ||
# gpu_mem_256=128 | ||
# gpu_mem_512=196 | ||
# gpu_mem_1024=384 | ||
# initramfs initramfs-linux.img followkernel | ||
# dtparam=audio=on | ||
# dtparam=spi=on | ||
# dtparam=i2c_arm=on | ||
# dtparam=i2c=on | ||
[all] | ||
avoid_warnings=1 | ||
disable_splash=1 | ||
boot_delay=0 | ||
'>>/boot/config.txt | ||
# groupadd weston 2> /dev/null | ||
# groupadd weston-launch 2> /dev/null | ||
# usermod -a -G wheel,games,power,optical,storage,scanner,lp,audio,video,render,weston,weston-launch ${USER} | ||
if [ -f /boot/boot.txt ]; then | ||
pacman -S --needed --noconfirm uboot-tools | ||
sed -i 's/rootwait/rootwait quiet loglevel=0/' /boot/boot.txt | ||
mkimage -T script -C none -n 'Raspberry Pi' -d /boot/boot.txt /boot/boot.scr | ||
fi | ||
if [ -f /boot/cmdline.txt ]; then | ||
sed -i 's/rootwait/rootwait quiet loglevel=0/' /boot/cmdline.txt | ||
fi | ||
" | ||
|
||
wl="$(which weston 2> /dev/null)" | ||
if [ "$wl" = "" ]; then | ||
echo 'unable to complete weston kiosk installation' | ||
exit 1 | ||
else | ||
touch ~/.hushlogin | ||
echo ' | ||
export HISTCONTROL=ignoredups:erasedups | ||
shopt -s histappend | ||
'>>~/.bashrc | ||
|
||
echo '#!/usr/bin/env sh | ||
weston-terminal --fullscreen'>~/.kiosk | ||
chmod a+x .kiosk | ||
|
||
mkdir -p ~/.config | ||
echo "[core] | ||
idle-time=0 | ||
repaint-window=15 | ||
require-input=false | ||
[shell] | ||
client=${HOME}/.kiosk | ||
animation=none | ||
close-animation=none | ||
startup-animation=none | ||
locking=false | ||
[output] | ||
name= | ||
mode= | ||
">~/.config/weston.ini | ||
yes "$1" | su -c reboot | ||
fi | ||
} | ||
|
||
source <(curl -s https://archibold.io/utils/ask-password) | ||
kiosk "$(askPassword 'root password:')" |