Changes between Version 9 and Version 10 of RB1100AHX4


Ignore:
Timestamp:
12/14/25 03:11:26 (3 days ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RB1100AHX4

    v9 v10  
    8282#PS1='\[\e[31m\]\u@\h\[\e[0m\]:\[\e[32m\]\w\[\e[0m\]\$ '
    8383}}}
     84
     85This script is good "/system/script/alpine_start"
     86{{{
     87:do {
     88    :local cname "alpine"
     89
     90    # Find existing container
     91    :local cid [/container find where name=$cname]
     92
     93    :if ($cid != "") do={
     94        :put ("Removing existing container: " . $cname)
     95        /container remove $cid
     96        :delay 5s
     97    } else={
     98        :put ("No existing container: " . $cname)
     99    }
     100
     101    :put "Creating alpine container..."
     102    /container add \
     103        name=$cname \
     104        remote-image=library/alpine:latest \
     105        interface=veth1 \
     106        root-dir=ram \
     107        cmd="tail -f /dev/null" \
     108        logging=yes
     109
     110    :delay 20s
     111
     112    :local newcid [/container find where name=$cname]
     113
     114    :if ($newcid = "") do={
     115        :put "ERROR: container was not created"
     116        :error "container create failed"
     117    }
     118
     119    :put "Starting alpine container..."
     120    /container start $newcid
     121
     122    :delay 5s
     123
     124    :put "Installing packages..."
     125    /container shell $newcid cmd="apk update"
     126    :delay 5s
     127    /container shell $newcid cmd="apk add --no-cache wget python3"
     128
     129    :delay 3s
     130
     131    :put "Downloading .profile..."
     132    /container shell $newcid cmd="wget -O /root/.profile http://192.168.108.200:8000/.profile"
     133
     134    :put "Alpine container setup complete"
     135}
     136
     137}}}