-
Notifications
You must be signed in to change notification settings - Fork 0
/
makepico8
60 lines (48 loc) · 1.86 KB
/
makepico8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# If you haven't done before, you should replace the "init"-value in cmdline.txt with these:
# init=/bin/bash -c "mount -t proc proc /proc; mount -t sysfs sys /sys; mount /boot; source /boot/makepico8"
# Preconfiguring...
mount -t tmpfs tmp /run
mkdir -p /run/systemd
mount / -o remount,rw
# Remove init-Script and replace it with some options to prevent Console-Output
sed -i 's| init=.*| loglevel=3 logo\.nologo fastboot|' /boot/cmdline.txt
sed -i 's|console=tty1|console=tty3|' /boot/cmdline.txt
# Create needed folders (if they don't exit already)
mkdir -p /boot/pico-8/screenshots
# Disable motd
touch /boot/pico-8/.hushlogin
# Create Group and User called "pico8"
groupadd pico8
useradd -d /boot/pico-8 -M -g pico8 -G video,audio,input -s /bin/bash pico8
# Set the hostname to "pico8desktop"
echo "pico8desktop" > /etc/hostname
# Change /etc/fstab . Without root- or sudo-Permission, normal users aren't capable of writing vfat-Partition.
# After these Changes, user "pico8" will be able to do so...
picouid=$(id -u pico8)
picogid=$(id -g pico8)
sed -i "s/\(\/boot.*vfat.*\)defaults\(.*\)/\1rw,uid=$picouid,gid=$picogid\2/" /etc/fstab
# Autologin the new User
mkdir /etc/systemd/system/[email protected]
cat > /etc/systemd/system/[email protected]/override.conf << EOF
[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/agetty --skip-login --noclear --noissue --login-options "-f pico8" %I $TERM
EOF
# Start PICO8 after Login
cat > /boot/pico-8/.profile << EOF
PS1=""
pgrep pico8 || (cd ~; amixer sset 'PCM' 80% > /dev/null 2>&1; ./pico8 > /dev/null 2>&1 -home /boot/pico-8 -desktop /boot/pico-8/screenshots -splore; sudo /sbin/shutdown -h now)
EOF
# Allow pico8 user to shutdown
cat >> /etc/sudoers << EOF
pico8 ALL=(ALL) NOPASSWD: /sbin/shutdown
EOF
#Postconfiguring...
sync
umount /boot
mount / -o remount,ro
sync
sleep 5
# Call Resize-Script
/usr/lib/raspi-config/init_resize.sh