fix: Avoid pipe to head on find (#751)

This commit is contained in:
Felipe Franciosi
2025-04-09 06:43:41 +01:00
committed by GitHub
parent ddd38dcd0b
commit 433265fa2e
10 changed files with 38 additions and 39 deletions

View File

@@ -54,8 +54,8 @@ jobs:
labels: | labels: |
org.opencontainers.image.title=${{ vars.NAME }} org.opencontainers.image.title=${{ vars.NAME }}
env: env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- -
@@ -112,6 +112,5 @@ jobs:
connection_url: ${{secrets.MAIL_CONNECTION}} connection_url: ${{secrets.MAIL_CONNECTION}}
subject: Build of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} completed subject: Build of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} completed
body: | body: |
The build job of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} was completed successfully! The build job of ${{ github.event.repository.name }} v${{ steps.meta.outputs.version }} was completed successfully!
See https://github.com/${{ github.repository }}/actions for more information. See https://github.com/${{ github.repository }}/actions for more information.

View File

@@ -7,7 +7,7 @@ jobs:
name: shellcheck name: shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- -
@@ -15,7 +15,7 @@ jobs:
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
env: env:
SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153
- -
name: Lint Dockerfile name: Lint Dockerfile
uses: hadolint/hadolint-action@v3.1.0 uses: hadolint/hadolint-action@v3.1.0
with: with:

View File

@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- -
name: Docker Hub Description name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4 uses: peter-evans/dockerhub-description@v4
with: with:

View File

@@ -85,7 +85,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
``` ```
Select from the values below: Select from the values below:
| **Value** | **Operating System** | **Size** | | **Value** | **Operating System** | **Size** |
|---|---|---| |---|---|---|
| `alma` | Alma Linux | 2.2 GB | | `alma` | Alma Linux | 2.2 GB |
@@ -110,7 +110,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
| `ubuntu` | Ubuntu Desktop | 6.0 GB | | `ubuntu` | Ubuntu Desktop | 6.0 GB |
| `ubuntus` | Ubuntu Server | 3.0 GB | | `ubuntus` | Ubuntu Server | 3.0 GB |
| `xubuntu` | Xubuntu | 4.0 GB | | `xubuntu` | Xubuntu | 4.0 GB |
### How can I use my own image? ### How can I use my own image?
If you want to download an operating system that is not in the list above, you can set the `BOOT` variable to the URL of the image: If you want to download an operating system that is not in the list above, you can set the `BOOT` variable to the URL of the image:
@@ -121,7 +121,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
``` ```
The `BOOT` URL accepts files in any of the following formats: The `BOOT` URL accepts files in any of the following formats:
| **Extension** | **Format** | | **Extension** | **Format** |
|---|---| |---|---|
| `.img` | Raw | | `.img` | Raw |
@@ -136,7 +136,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
It will also accept files such as `.img.gz`, `.qcow2.xz`, `.iso.zip` and many more, because it will automaticly extract compressed files. It will also accept files such as `.img.gz`, `.qcow2.xz`, `.iso.zip` and many more, because it will automaticly extract compressed files.
Alternatively you can use a local image file directly, by binding it in your compose file: Alternatively you can use a local image file directly, by binding it in your compose file:
```yaml ```yaml
volumes: volumes:
- ./example.iso:/boot.iso - ./example.iso:/boot.iso
@@ -163,7 +163,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
environment: environment:
DISK_SIZE: "128G" DISK_SIZE: "128G"
``` ```
> [!TIP] > [!TIP]
> This can also be used to resize the existing disk to a larger capacity without any data loss. > This can also be used to resize the existing disk to a larger capacity without any data loss.
@@ -194,12 +194,12 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
### How do I boot without UEFI? ### How do I boot without UEFI?
By default, the machine will boot with UEFI enabled. If your OS does not support that, you can boot with a legacy BIOS: By default, the machine will boot with UEFI enabled. If your OS does not support that, you can boot with a legacy BIOS:
```yaml ```yaml
environment: environment:
BOOT_MODE: "legacy" BOOT_MODE: "legacy"
``` ```
### How do I boot without VirtIO drivers? ### How do I boot without VirtIO drivers?
By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems. By default, the machine makes use of `virtio-scsi` drives for performance reasons, and even though most Linux kernels bundle the necessary driver for this device, that may not always be the case for other operating systems.
@@ -220,9 +220,9 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
| **Product** | **Linux** | **Win11** | **Win10** | **macOS** | | **Product** | **Linux** | **Win11** | **Win10** | **macOS** |
|---|---|---|---|---| |---|---|---|---|---|
| Docker CLI | ✅ | ✅ | ❌ | ❌ | | Docker CLI | ✅ | ✅ | ❌ | ❌ |
| Docker Desktop | ❌ | ✅ | ❌ | ❌ | | Docker Desktop | ❌ | ✅ | ❌ | ❌ |
| Podman CLI | ✅ | ✅ | ❌ | ❌ | | Podman CLI | ✅ | ✅ | ❌ | ❌ |
| Podman Desktop | ✅ | ✅ | ❌ | ❌ | | Podman Desktop | ✅ | ✅ | ❌ | ❌ |
After that you can run the following commands in Linux to check your system: After that you can run the following commands in Linux to check your system:
@@ -244,7 +244,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
### How do I expose network ports? ### How do I expose network ports?
You can expose ports just by adding them to your compose file. If you want to be able to connect to the SSH service of the machine for example, you would add it like this: You can expose ports just by adding them to your compose file. If you want to be able to connect to the SSH service of the machine for example, you would add it like this:
```yaml ```yaml
ports: ports:
- 2222:22 - 2222:22
@@ -254,7 +254,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
### How do I assign an individual IP address to the container? ### How do I assign an individual IP address to the container?
By default, the container uses bridge networking, which shares the IP address with the host. By default, the container uses bridge networking, which shares the IP address with the host.
If you want to assign an individual IP address to the container, you can create a macvlan network as follows: If you want to assign an individual IP address to the container, you can create a macvlan network as follows:
@@ -265,8 +265,8 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
--ip-range=192.168.0.100/28 \ --ip-range=192.168.0.100/28 \
-o parent=eth0 vlan -o parent=eth0 vlan
``` ```
Be sure to modify these values to match your local subnet. Be sure to modify these values to match your local subnet.
Once you have created the network, change your compose file to look as follows: Once you have created the network, change your compose file to look as follows:
@@ -283,7 +283,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
vlan: vlan:
external: true external: true
``` ```
An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default. An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.
> [!IMPORTANT] > [!IMPORTANT]
@@ -307,7 +307,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
### How do I add multiple disks? ### How do I add multiple disks?
To create additional disks, modify your compose file like this: To create additional disks, modify your compose file like this:
```yaml ```yaml
environment: environment:
DISK2_SIZE: "32G" DISK2_SIZE: "32G"
@@ -350,7 +350,7 @@ kubectl apply -f https://raw.githubusercontent.com/qemus/qemu/refs/heads/master/
``` ```
Then start the container and execute the following command in the guest: Then start the container and execute the following command in the guest:
```shell ```shell
mount -t 9p -o trans=virtio shared /mnt/example mount -t 9p -o trans=virtio shared /mnt/example
``` ```

View File

@@ -144,7 +144,7 @@ getURL() {
name="OpenSUSE" name="OpenSUSE"
if [[ "$ret" == "url" ]]; then if [[ "$ret" == "url" ]]; then
body=$(pipe "https://download.opensuse.org/distribution/leap/") || exit 65 body=$(pipe "https://download.opensuse.org/distribution/leap/") || exit 65
version=$(echo "$body" | grep 'class="name"' | cut -d '/' -f2 | grep -v 42 | sort -r | head -n 1) version=$(echo "$body" | grep 'class="name"' | cut -d '/' -f2 | grep -v 42 | sort -r | head -n 1)
url="https://download.opensuse.org/distribution/leap/$version/installer/iso/agama-installer-Leap.x86_64-Leap.iso" url="https://download.opensuse.org/distribution/leap/$version/installer/iso/agama-installer-Leap.x86_64-Leap.iso"
arm="https://download.opensuse.org/distribution/leap/$version/installer/iso/agama-installer-Leap.aarch64-Leap.iso" arm="https://download.opensuse.org/distribution/leap/$version/installer/iso/agama-installer-Leap.aarch64-Leap.iso"
fi ;; fi ;;

View File

@@ -203,9 +203,9 @@ findFile() {
local ext="$1" local ext="$1"
local fname="boot.$ext" local fname="boot.$ext"
dir=$(find / -maxdepth 1 -type d -iname "$fname" | head -n 1) dir=$(find / -maxdepth 1 -type d -iname "$fname" -print -quit)
[ ! -d "$dir" ] && dir=$(find "$STORAGE" -maxdepth 1 -type d -iname "$fname" | head -n 1) [ ! -d "$dir" ] && dir=$(find "$STORAGE" -maxdepth 1 -type d -iname "$fname" -print -quit)
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
if hasDisk; then if hasDisk; then
BOOT="$dir" && return 0 BOOT="$dir" && return 0
@@ -213,8 +213,8 @@ findFile() {
error "The bind $dir maps to a file that does not exist!" && exit 37 error "The bind $dir maps to a file that does not exist!" && exit 37
fi fi
file=$(find / -maxdepth 1 -type f -iname "$fname" | head -n 1) file=$(find / -maxdepth 1 -type f -iname "$fname" -print -quit)
[ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$fname" | head -n 1) [ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$fname" -print -quit)
detectType "$file" && return 0 detectType "$file" && return 0

View File

@@ -207,7 +207,7 @@ configureNAT() {
fi fi
if [ ! -c /dev/net/tun ]; then if [ ! -c /dev/net/tun ]; then
[[ "$PODMAN" != [Yy1]* ]] && error "$tuntap" [[ "$PODMAN" != [Yy1]* ]] && error "$tuntap"
return 1 return 1
fi fi
@@ -215,7 +215,7 @@ configureNAT() {
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || : { sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || :
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
[[ "$PODMAN" != [Yy1]* ]] && error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1" [[ "$PODMAN" != [Yy1]* ]] && error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
return 1 return 1
fi fi
fi fi
@@ -379,7 +379,7 @@ getInfo() {
error "Network interface '$VM_NET_DEV' does not exist inside the container!" error "Network interface '$VM_NET_DEV' does not exist inside the container!"
error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 26 error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 26
fi fi
BASE_IP="${VM_NET_IP%.*}." BASE_IP="${VM_NET_IP%.*}."
if [ "${VM_NET_IP/$BASE_IP/}" -lt "3" ]; then if [ "${VM_NET_IP/$BASE_IP/}" -lt "3" ]; then

View File

@@ -36,7 +36,7 @@ if [[ "$KVM" != [Nn]* ]]; then
KVM="N" KVM="N"
if [[ "$OSTYPE" =~ ^darwin ]]; then if [[ "$OSTYPE" =~ ^darwin ]]; then
warn "you are using macOS which has no KVM support, this will cause a major loss of performance." warn "you are using macOS which has no KVM support, this will cause a major loss of performance."
else else
kernel=$(uname -a) kernel=$(uname -a)
case "${kernel,,}" in case "${kernel,,}" in
*"microsoft"* ) *"microsoft"* )

View File

@@ -113,15 +113,15 @@ cpu() {
local cpu="" local cpu=""
ret=$(lscpu) ret=$(lscpu)
if grep -qi "model name" <<< "$ret"; then if grep -qi "model name" <<< "$ret"; then
cpu=$(echo "$ret" | grep -m 1 -i 'model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g') cpu=$(echo "$ret" | grep -m 1 -i 'model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
fi fi
if [ -z "${cpu// /}" ] && grep -qi "model:" <<< "$ret"; then if [ -z "${cpu// /}" ] && grep -qi "model:" <<< "$ret"; then
cpu=$(echo "$ret" | grep -m 1 -i 'model:' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g') cpu=$(echo "$ret" | grep -m 1 -i 'model:' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/ */ /g')
fi fi
cpu="${cpu// CPU/}" cpu="${cpu// CPU/}"
cpu="${cpu// 4 Core/}" cpu="${cpu// 4 Core/}"
cpu="${cpu// 6 Core/}" cpu="${cpu// 6 Core/}"
@@ -147,7 +147,7 @@ cpu() {
cpu="${cpu// Core TM/ Core}" cpu="${cpu// Core TM/ Core}"
cpu="${cpu// with Radeon Graphics/}" cpu="${cpu// with Radeon Graphics/}"
cpu="${cpu// with Radeon Vega Graphics/}" cpu="${cpu// with Radeon Vega Graphics/}"
[ -z "${cpu// /}" ] && cpu="Unknown" [ -z "${cpu// /}" ] && cpu="Unknown"
echo "$cpu" echo "$cpu"

View File

@@ -74,7 +74,7 @@ function processInfo() {
var path = window.location.pathname.replace(/[^/]*$/, '').replace(/\/$/, ''); var path = window.location.pathname.replace(/[^/]*$/, '').replace(/\/$/, '');
var wsUrl = protocol + "//" + window.location.host + path + "/websockify"; var wsUrl = protocol + "//" + window.location.host + path + "/websockify";
var webSocket = webSocketFactory.connect(wsUrl); var webSocket = webSocketFactory.connect(wsUrl);
return true; return true;
} }