Skip to content

Instantly share code, notes, and snippets.

@zsteva
Created April 23, 2024 16:50
Show Gist options
  • Select an option

  • Save zsteva/e155af1c529d3cc43b76f6055bcf2ddc to your computer and use it in GitHub Desktop.

Select an option

Save zsteva/e155af1c529d3cc43b76f6055bcf2ddc to your computer and use it in GitHub Desktop.
#!/bin/bash
# wordfence appimage builder
# by [email protected]
APPTOOL_URL="https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage"
PY_URL="https://github.com/niess/python-appimage/releases/download/python3.12/python3.12.3-cp312-cp312-manylinux_2_28_x86_64.AppImage"
APPTOOL_NAME="$(basename "$APPTOOL_URL")"
PY_NAME="$(basename "$PY_URL")"
if [ ! -e "${APPTOOL_NAME}" ]; then
rm -f "${APPTOOL_NAME}_"
wget -O "${APPTOOL_NAME}_" "${APPTOOL_URL}" \
&& mv "${APPTOOL_NAME}_" "${APPTOOL_NAME}" \
|| exit 39
chmod a+rx "${APPTOOL_NAME}"
fi
if [ ! -e "${PY_NAME}" ]; then
rm -f "${PY_NAME}_"
wget -O "${PY_NAME}_" "${PY_URL}" \
&& mv "${PY_NAME}_" "${PY_NAME}" \
|| exit 39
chmod a+rx "${PY_NAME}"
fi
rm -rf "./squashfs-root"
./${PY_NAME} --appimage-extract
./squashfs-root/AppRun -m pip install wordfence
rm -f ./squashfs-root/*.desktop
cat > ./squashfs-root/wordfence.desktop << __EOF__
[Desktop Entry]
Type=Application
Name=wordfence
Exec=wordfence
Comment=wordfence
Icon=python
Categories=Utility;
Terminal=true
__EOF__
sed -i -e 's,"$@","${APPDIR}/usr/bin/wordfence" "$@",' squashfs-root/AppRun
rm -f "wordfence.AppImage"
./${APPTOOL_NAME} ./squashfs-root/ wordfence.AppImage
rm -rf "./squashfs-root"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment