mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
WIP persistence
This commit is contained in:
parent
1ea6d270f8
commit
f0bc10f1e8
@ -6,7 +6,7 @@ RUN apk add --update \
|
||||
gcc make gcompat musl-dev libx11-dev xinit \
|
||||
bind-tools \
|
||||
util-linux \
|
||||
htop vim nano \
|
||||
htop vim nano jq \
|
||||
&& \
|
||||
setup-xorg-base xhost xterm xcalc xdotool xkill || true && \
|
||||
setup-devd udev || true && \
|
||||
@ -16,6 +16,18 @@ RUN apk add --update \
|
||||
chsh -s /bin/bash
|
||||
|
||||
RUN apk add neofetch
|
||||
# programming language tools
|
||||
RUN apk add --no-cache \
|
||||
nodejs npm \
|
||||
php \
|
||||
perl \
|
||||
go
|
||||
|
||||
# Fun packages
|
||||
RUN apk add cowsay --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
|
||||
# Shell
|
||||
RUN apk add zsh sudo git libgit2
|
||||
|
||||
COPY rootfs/ /
|
||||
|
||||
@ -24,20 +36,17 @@ RUN chmod +x /etc/init.d/basic-boot
|
||||
|
||||
COPY assets/epoxy-server /bin/epoxy-server
|
||||
RUN chmod u+x /bin/epoxy-server
|
||||
|
||||
RUN chmod +x /etc/init.d/puter-save-daemon
|
||||
|
||||
RUN rc-update add twisp-service default
|
||||
RUN rc-update add puter-save-daemon default
|
||||
|
||||
RUN rc-update add debug-service default
|
||||
|
||||
RUN chmod +x /etc/init.d/network-service
|
||||
RUN rc-update add network-service default
|
||||
|
||||
# programming language tools
|
||||
RUN apk add --no-cache \
|
||||
nodejs npm \
|
||||
php \
|
||||
perl \
|
||||
go
|
||||
|
||||
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
# ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
# RUN rustup default nightly
|
||||
@ -57,12 +66,6 @@ RUN \
|
||||
rc-update add killprocs shutdown && \
|
||||
rc-update add savecache shutdown
|
||||
|
||||
# Fun packages
|
||||
RUN apk add cowsay --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
||||
|
||||
# Shell
|
||||
RUN apk add zsh sudo git libgit2
|
||||
|
||||
RUN mkdir /root/Downloads
|
||||
|
||||
# Setup user
|
||||
@ -97,4 +100,9 @@ RUN echo "/etc/puter-motd" >> /root/.zshrc
|
||||
RUN cp /root/.zshrc /home/puter-user/.zshrc
|
||||
RUN cp /root/.bashrc /home/puter-user/.bashrc
|
||||
|
||||
RUN chmod +x /bin/puter-save
|
||||
RUN chmod +x /bin/puter-save-daemon
|
||||
RUN chmod +x /bin/puter-restore
|
||||
RUN chmod +x /etc/apk/commit_hooks.d/puter.sh
|
||||
|
||||
RUN bash
|
||||
|
7
src/emulator/image/rootfs/bin/puter-restore
Normal file
7
src/emulator/image/rootfs/bin/puter-restore
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
PUTERUSERNAME=$( cat /proc/cmdline | sed -n 's/.*puterusername=\(.*\)/\1/p' )
|
||||
|
||||
echo > /tmp/restore-in-progress
|
||||
tar -C / -zxvf /puter/$PUTERUSERNAME/emulatorstate.apkovl.tar.gz # no worries if this errors, its just the first boot
|
||||
apk add --no-cache $(cat /etc/apk/world)
|
||||
rm /tmp/restore-in-progress
|
4
src/emulator/image/rootfs/bin/puter-save
Normal file
4
src/emulator/image/rootfs/bin/puter-save
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
PUTERUSERNAME=$( cat /proc/cmdline | sed -n 's/.*puterusername=\(.*\)/\1/p' )
|
||||
lbu package - > /puter/$PUTERUSERNAME/emulatorstate.apkovl.tar.gz
|
3
src/emulator/image/rootfs/bin/puter-save-daemon
Normal file
3
src/emulator/image/rootfs/bin/puter-save-daemon
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
inotifyd /bin/puter-save /etc:cdDw
|
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo saving state to puter...
|
||||
puter-save
|
15
src/emulator/image/rootfs/etc/init.d/puter-save-daemon
Normal file
15
src/emulator/image/rootfs/etc/init.d/puter-save-daemon
Normal file
@ -0,0 +1,15 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Puter Save Daemon"
|
||||
command="/bin/puter-save-daemon"
|
||||
command_args=""
|
||||
command_background="yes"
|
||||
pidfile="/var/run/puter-save-daemon.pid"
|
||||
start_stop_daemon_args="--background --make-pidfile"
|
||||
output_log="/dev/ttyS0"
|
||||
error_log="/dev/ttyS0"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
after bootmisc
|
||||
}
|
@ -308,7 +308,7 @@ window.onload = async function()
|
||||
url: './image/build/boot/vmlinuz-virt',
|
||||
async: false
|
||||
},
|
||||
cmdline: 'rw root=/dev/sda init=/sbin/init rootfstype=ext4',
|
||||
cmdline: 'rw root=/dev/sda init=/sbin/init rootfstype=ext4 puterusername=' + (await puter.getUser()).username,
|
||||
// cmdline: 'rw root=/dev/sda init=/bin/bash rootfstype=ext4',
|
||||
// cmdline: "rw init=/sbin/init root=/dev/sda rootfstype=ext4",
|
||||
// cmdline: "rw init=/sbin/init root=/dev/sda rootfstype=ext4 random.trust_cpu=on 8250.nr_uarts=10 spectre_v2=off pti=off mitigations=off",
|
||||
|
Loading…
Reference in New Issue
Block a user