modified: .github/workflows/mikrotik_patch.yml

new file:   busybox/Makefile
	new file:   busybox/busybox
	new file:   busybox/go.mod
	new file:   busybox/main.go
This commit is contained in:
zyb 2024-06-30 18:06:45 +08:00
parent 0d554bc991
commit ca44942adb
5 changed files with 33 additions and 6 deletions

View File

@ -41,6 +41,10 @@ jobs:
with:
python-version: '3.11'
- uses: actions/setup-go@v5
with:
go-version: '>=1.17.0'
- name: Cache Squashfs
id: cache-squashfs
uses: actions/cache@v4
@ -53,13 +57,14 @@ jobs:
- name: Create Squashfs for option and python3
if: steps.cache-squashfs.outputs.cache-hit != 'true'
run: |
sudo wget -O bash -nv https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/busybox_ASH
sudo wget -O busybox -nv https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/busybox
sudo chmod +x busybox
sudo chmod +x bash
cd busybox
sudo make
cd ..
sudo mkdir -p ./option-root/bin/
sudo mv busybox ./option-root/bin/
sudo mv bash ./option-root/bin/
sudo cp ./busybox/busybox ./option-root/bin/
sudo cp ./busybox/bash ./option-root/bin/
sudo chmod +x ./option-root/bin/busybox
sudo chmod +x ./option-root/bin/bash
COMMANDS=$(./option-root/bin/busybox --list)
for cmd in $COMMANDS; do
sudo ln -sf /pckg/option/bin/busybox ./option-root/bin/$cmd

2
busybox/Makefile Normal file
View File

@ -0,0 +1,2 @@
all:
GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -extldflags '-static'" -o bash

BIN
busybox/busybox Normal file

Binary file not shown.

3
busybox/go.mod Normal file
View File

@ -0,0 +1,3 @@
module bash
go 1.21.5

17
busybox/main.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
"log"
"os"
"os/exec"
)
func main() {
busybox := "busybox"
args := []string{"ash"}
cmd := exec.Command(busybox, args...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Fatalf("execv error: %v", err)
}
}