update to support bubble 0.3.0^, fix various problems and support loading tailscale
This commit is contained in:
+2
-1
@@ -7,10 +7,11 @@ COPY --from=0 --chmod=0755 /src/bubble.sh /bin/bubble
|
|||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
apt-get update && apt-get upgrade
|
apt-get update && apt-get upgrade
|
||||||
chmod +x /bin/bubble
|
chmod +x /bin/bubble
|
||||||
apt-get install -y curl jq neovim htop fish tmux sudo git iproute2 iputils-ping dnsutils build-essential htop
|
apt-get install -y curl jq neovim htop fish tmux sudo git iproute2 iputils-ping dnsutils openssh-sftp-server build-essential htop
|
||||||
useradd -m -s /usr/bin/fish user
|
useradd -m -s /usr/bin/fish user
|
||||||
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
|
echo "user ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||||
sudo -u user mkdir -p /home/user/.config/fish/
|
sudo -u user mkdir -p /home/user/.config/fish/
|
||||||
|
ln -s /usr/lib/openssh/sftp-server /usr/sbin/bubble-sftp
|
||||||
EOF
|
EOF
|
||||||
COPY ./init.fish /init.fish
|
COPY ./init.fish /init.fish
|
||||||
COPY --chown=user ./user.fish /home/user/.config/fish/config.fish
|
COPY --chown=user ./user.fish /home/user/.config/fish/config.fish
|
||||||
|
|||||||
@@ -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"
|
if ! cat /etc/passwd | grep -E "^user"
|
||||||
echo "User was not created correctly. Creating user..."
|
echo "User was not created correctly. Creating user..."
|
||||||
useradd -m -s /usr/bin/fish user
|
useradd -m -s /usr/bin/fish user
|
||||||
@@ -17,12 +44,13 @@ function resume
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if sudo -u user tmux has-session -t 0
|
if sudo -u user tmux has-session -t 0
|
||||||
if sudo -u user tmux ls | grep -E "^0.*attached)"
|
# if sudo -u user tmux ls | grep -E "^0.*attached)"
|
||||||
echo "The default tmux session has been attached, dropping you to a normal shell."
|
# echo "The default tmux session has been attached, dropping you to a normal shell."
|
||||||
cd /home/user && sudo -u user /usr/bin/fish
|
# cd /home/user && sudo -u user /usr/bin/fish
|
||||||
else
|
# else
|
||||||
sudo -u user tmux attach -t 0
|
# sudo -u user tmux attach -t 0
|
||||||
end
|
# end
|
||||||
|
sudo -u user tmux attach -t 0
|
||||||
else
|
else
|
||||||
cd /home/user
|
cd /home/user
|
||||||
sudo -u user tmux new-session -c /usr/bin/fish
|
sudo -u user tmux new-session -c /usr/bin/fish
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
if test -e $BUBBLE_SOCK
|
echo "Type 'bubble' for help."
|
||||||
echo "Manager capability is detected. Type 'bubble' for help."
|
|
||||||
end
|
|
||||||
|
|
||||||
if test ! -e /usr/bin/docker
|
if test ! -e /usr/sbin/tailscaled
|
||||||
echo "Docker is not installed. Type 'install-docker' to install if needed."
|
echo "Tailscale is not installed. Type 'install-tailscale' to install if needed."
|
||||||
end
|
end
|
||||||
|
|
||||||
function exit
|
function exit
|
||||||
@@ -18,31 +16,16 @@ function logout
|
|||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
function install-docker
|
function install-tailscale
|
||||||
if test -e /usr/bin/docker
|
if test -f /usr/sbin/tailscaled
|
||||||
echo "Docker is already present at /bin/docker."
|
echo "Tailscale is already installed at /usr/sbin/tailscaled"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
echo "Installing docker in 3s."
|
if curl -fsSL https://tailscale.com/install.sh | sh
|
||||||
sleep 3s
|
echo "[TAILSCALE] Tailscale should be installed successfully. Starting tailscaled..."
|
||||||
echo "[DOCKER] Updating software registry."
|
sudo nohup /usr/sbin/tailscaled --tun=userspace-networking --socks5-server=localhost:1080 > /dev/null 2>&1 &
|
||||||
sudo apt-get update
|
echo "Tailscaled is running in background. try running 'tailscale status'"
|
||||||
sudo apt-get install ca-certificates
|
else
|
||||||
echo "[DOCKER] Updating package manager keyrings"
|
echo "Failed to install tailscale."
|
||||||
sudo install -m 0755 -d /etc/apt/keyrings
|
end
|
||||||
echo "[DOCKER] Adding trust for docker repository"
|
|
||||||
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
|
||||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
|
||||||
echo "[DOCKER] Adding docker repository"
|
|
||||||
bash -c 'echo \
|
|
||||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
|
|
||||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
|
||||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'
|
|
||||||
sudo apt-get update
|
|
||||||
echo "[DOCKER] Installing docker"
|
|
||||||
if sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
||||||
echo "[DOCKER] Docker should be installed successfully"
|
|
||||||
else
|
|
||||||
echo "Unexpected error."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user