Skip to content

Commit

Permalink
Add overlayfs-tools back as submodule (#114)
Browse files Browse the repository at this point in the history
Now that the project is being actively maintained it makes more sense to
have it included as a submodule, rather than maintaining a separate copy
of the code for this project.

Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye authored Jul 11, 2024
1 parent 054bdde commit f4cec53
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 1,090 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup environment
id: setup
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "overlayfs-tools"]
path = overlayfs-tools
url = https://www.github.com/kmxz/overlayfs-tools
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A table located at `/etc/ztab` is used to configure any number and type of zram
Using the table an OverlayFS mount is used to mount the newly created zram device as the upper filesystem of the OverlayFS.
OverlayFS is used so that files do not need to be copied from persistent storage to RAM on startup.
In theory this should allow for faster boots and larger directories as no complete directory copy is needed.
A modified version of [kmxz/overlayfs-tools](https://github.com/kmxz/overlayfs-tools) is used to implement the OverlayFS sync logic.
A version of [kmxz/overlayfs-tools](https://github.com/kmxz/overlayfs-tools) is used to implement the OverlayFS sync logic.

This tool is primarily developed and tested against Raspberry Pi OS.
Any Debian derivative should also work out of the box, however there is no guarantee.
Expand Down Expand Up @@ -43,7 +43,7 @@ Experimental Alpine support has also been added, other distributions may work bu

``` shell
sudo apt-get install git
git clone https://github.com/ecdye/zram-config
git clone --recurse-submodules https://github.com/ecdye/zram-config
sudo ./zram-config/install.bash
```

Expand Down Expand Up @@ -209,7 +209,7 @@ You might have text based low impact directories such as `/var/log` or `/var/cac
With `/tmp` and `/run`, zram is unnecessary because they are RAM mounted as `tmpfs` and, if memory gets short, then the zram swap will provide extra.
It is only under intense loads that the slight overhead of zram compression becomes noticeable.

This chart from [facebook/zstd](https://github.com/facebook/zstd?tab=readme-ov-file#benchmarks) provides a good benchmark for the performance of the different compressors.
This chart in [facebook/zstd](https://github.com/facebook/zstd?tab=readme-ov-file#benchmarks) provides a good reference for the performance of the different compressors.

### Reference

Expand Down
18 changes: 10 additions & 8 deletions install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ if [[ -s /usr/local/sbin/zram-config ]] || [[ -s /usr/sbin/zram-config ]]; then
exit 1
fi

if [[ $OS == "alpine" ]] && ! [[ "$(apk info 2> /dev/null | grep -E '^(gcc|make|fts-dev|linux-headers|util-linux-misc|musl-dev)' | tr '\n' ' ')" == "fts-dev gcc make util-linux-misc musl-dev linux-headers " ]]; then
echo "Installing needed packages (gcc, make, fts-dev, linux-headers, util-linux-misc, musl-dev)"
apk add gcc make fts-dev linux-headers util-linux-misc musl-dev || exit 1
elif ! dpkg -s 'gcc' 'make' 'libc6-dev' &> /dev/null; then
echo "Installing needed packages (gcc, make, libc6-dev)"
apt-get install --yes gcc make libc6-dev || exit 1
if [[ $OS == "alpine" ]] && ! [[ "$(apk info 2> /dev/null | grep -E '^(gcc|meson|fts-dev|linux-headers|util-linux-misc|musl-dev)' | tr '\n' ' ')" == "fts-dev gcc meson util-linux-misc musl-dev linux-headers " ]]; then
echo "Installing needed packages (gcc, meson, fts-dev, linux-headers, util-linux-misc, musl-dev)"
apk add gcc meson fts-dev linux-headers util-linux-misc musl-dev || exit 1
elif ! dpkg -s 'gcc' 'meson' 'libc6-dev' &> /dev/null; then
echo "Installing needed packages (gcc, meson, libc6-dev)"
apt-get install --yes gcc meson libc6-dev || exit 1
fi

UBUNTU_VERSION="$(grep -o '^VERSION_ID=.*$' /etc/os-release | cut -d'=' -f2 | tr -d '"')"
Expand All @@ -45,7 +45,10 @@ if [[ $OS == "ubuntu" ]] && [[ $(bc -l <<< "$UBUNTU_VERSION >= 21.10") -eq 1 ]];
fi
fi

make --always-make --directory="${BASEDIR}/overlayfs-tools"
rm -rf "$BASEDIR"/overlayfs-tools/builddir
meson setup "$BASEDIR"/overlayfs-tools/builddir "$BASEDIR"/overlayfs-tools || exit 1
meson compile -C "$BASEDIR"/overlayfs-tools/builddir || exit 1
meson install -C "$BASEDIR"/overlayfs-tools/builddir || exit 1

echo "Installing zram-config files"
if [[ "$OS" == "alpine" ]]; then
Expand All @@ -62,7 +65,6 @@ ln -s /usr/local/share/zram-config/log /var/log/zram-config
install -m 755 "$BASEDIR"/uninstall.bash /usr/local/share/zram-config/uninstall.bash
install -m 644 "$BASEDIR"/service/zram-config.logrotate /etc/logrotate.d/zram-config
mkdir -p /usr/local/lib/zram-config/
install -m 755 "$BASEDIR"/overlayfs-tools/overlay /usr/local/lib/zram-config/overlay

echo "Starting zram-config service"
if [[ "$OS" == "alpine" ]]; then
Expand Down
1 change: 1 addition & 0 deletions overlayfs-tools
Submodule overlayfs-tools added at 162a5b
42 changes: 0 additions & 42 deletions overlayfs-tools/README.md

This file was deleted.

Loading

0 comments on commit f4cec53

Please sign in to comment.