update to support bubble 0.3.0^, fix various problems and support loading tailscale

This commit is contained in:
iceBear67
2025-09-25 16:40:10 +08:00
parent 86b3d8b97a
commit b3e32f11bc
3 changed files with 51 additions and 39 deletions
+34 -6
View File
@@ -1,3 +1,30 @@
function init
if test -f /tmp/bubble_container_started
return
end
echo "First login detected, initializing container environment..."
if ! touch /tmp/bubble_container_started
echo "FAILED to mark status. The initialization was cancelled."
echo "Certain services (like Tailscale) won't work."
end
if test -f /usr/sbin/tailscaled
echo "Starting tailscaled"
chmod +x /usr/sbin/tailscaled
nohup /usr/sbin/tailscaled \
--tun=userspace-networking \
--socks5-server=localhost:1080 > /dev/null 2>&1 &
echo "Started!"
end
echo "Looking for services from /etc/init.d/"
for script in /etc/init.d/*
if test -x script
nohup $script start > /dev/null 2>&1 &
end
end
end
init
if ! cat /etc/passwd | grep -E "^user"
echo "User was not created correctly. Creating user..."
useradd -m -s /usr/bin/fish user
@@ -17,12 +44,13 @@ function resume
return
end
if sudo -u user tmux has-session -t 0
if sudo -u user tmux ls | grep -E "^0.*attached)"
echo "The default tmux session has been attached, dropping you to a normal shell."
cd /home/user && sudo -u user /usr/bin/fish
else
sudo -u user tmux attach -t 0
end
# if sudo -u user tmux ls | grep -E "^0.*attached)"
# echo "The default tmux session has been attached, dropping you to a normal shell."
# cd /home/user && sudo -u user /usr/bin/fish
# else
# sudo -u user tmux attach -t 0
# end
sudo -u user tmux attach -t 0
else
cd /home/user
sudo -u user tmux new-session -c /usr/bin/fish