Skip to content

Instantly share code, notes, and snippets.

@clairem-sl
Last active December 29, 2025 20:07
Show Gist options
  • Select an option

  • Save clairem-sl/dbc39b4dab636857fe649ad6e18f9022 to your computer and use it in GitHub Desktop.

Select an option

Save clairem-sl/dbc39b4dab636857fe649ad6e18f9022 to your computer and use it in GitHub Desktop.
Kokua RAMCache Script

Kokua with RAMCache

/var/cache/kokua

cd /var/cache
sudo rm -rf kokua
sudo mkdir -p kokua
chmod ugo+rwx kokua

/etc/fstab

Add the following line:

tmpfs   /var/cache/kokua   tmpfs   noauto,user,exec,nodev,nosuid,mode=1777,size=6g 0 0

Adjust size=6g as necessary. Recommended to be Cache Size Limit in Kokua + at least 2g.

(A "g" is a GiB)

~/.kokua/cache_persistent

cd ~/.kokua
mkdir cache_persistent

Kokua Application shortcut

Copy the file kokua-viewer-ramcache.desktop (from this gist) to ~/.local/share/applications

Edit as necessary (notably, the installation path, which must be reflected in the Exec=, Icon=, and Path=

Kokua RAMcache wrapper

Copy the file kokua-ramcache.sh (from this gist) to the Kokua installation path (same as above)

#!/usr/bin/env bash
echo "KOKUA_CACHE=${KOKUA_CACHE:=/var/cache/kokua}"
echo "KOKUA_PERSIST=${KOKUA_PERSIST:=$HOME/.kokua/cache_persistent}"
echo "/etc/fstab for $KOKUA_CACHE:"
if ! awk -v"KC=$KOKUA_CACHE" 'BEGIN {r=1} $2 == KC {$1=$1; print $0; r=0} END {exit r}' /etc/fstab; then
echo "$KOKUA_CACHE not declared in /etc/fstab! Will bypass RAMCache"
BYPASS=x
fi
if [[ -z $BYPASS ]]; then
if ! grep -q "$KOKUA_CACHE" /proc/mounts; then
echo "$KOKUA_CACHE not yet mounted, mounting..."
mount "$KOKUA_CACHE"
else
echo "$KOKUA_CACHE already mounted."
fi
if [[ -d "$KOKUA_PERSIST" ]]; then
echo "$KOKUA_PERSIST found, restoring..."
rsync -aO --exclude='cef_cache' "${KOKUA_PERSIST%/}"/ "${KOKUA_CACHE%/}"/
else
echo "$KOKUA_PERSIST not found!"
fi
fi
./kokua
if [[ -z $BYPASS ]]; then
if [[ -d "$KOKUA_PERSIST" ]]; then
echo "$KOKUA_PERSIST found, saving..."
rsync -a --delete --exclude='cef_cache' "${KOKUA_CACHE%/}"/ "${KOKUA_PERSIST%/}"/
else
echo "$KOKUA_PERSIST not found!"
fi
umount "$KOKUA_CACHE"
fi
[Desktop Entry]
Categories=Application;Network;
Comment=Client for the On-line Virtual Worlds
Exec=/opt/kokua/kokua-ramcache.sh
Icon=/opt/kokua/etc/../kokua_icon.png
Name=kokua (with RAMcache)
NoDisplay=false
Path=/opt/kokua
PrefersNonDefaultGPU=false
StartupNotify=true
StartupWMClass=do-not-directly-run-kokua-bin
Terminal=false
TerminalOptions=
Type=Application
X-Desktop-File-Install-Version=3.0
X-KDE-SubstituteUID=false
X-KDE-Username=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment