Jump to content
America's Comeback

Overview

About This Club

A collection of tutorials for Rocky 9 linux that are useful to system administrators.
  1. What's new in this club
  2. It helps to reflect/feel at least one day per week, instead of only being active and taking actions.
  3. In observance with my own obedience in Yeshua's Commandments, I seek to use the skills that have been given to me to freely give to others so that they too may apply their own alignment in Yeshua's Commandments with their efforts online. This script is called IPS.Shabbat and its available on GitHub completely free and unlicensed. https://github.com/andreimerlescu/ips.shabbat IPS.Shabbat This plugin allows you to observe the Sabbath on your IPS Community that is self-hosted. Installation IPS Community: /var/www/ips PHP: 8.1.27 Linux: Rocky 9 Database: MariaDB Install the shabbat.php script inside your /var/www/ips directory so it lives at /var/www/ips/shabbat.php and has the owner of apache with the group of apache and permissions of 0644. Add DirectoryIndex shabbat.php index.php index.html index.htm to the .htaccess at /var/www/ips/.htaccess [rocky@localhost ~ /var/www]$ git clone https://github.com/andreimerlescu/ips.shabbat.git [rocky@localhost ~ /var/www]$ cp ips.shabbat/shabbat.php ips/shabbat.php [rocky@localhost ~ /var/www]$ echo "DirectoryIndex shabbat.php index.php index.html index.htm" | tee -a /var/www/ips/.htaccess > /dev/null [rocky@localhost ~ /var/www]$ # POST-INSTALL CLEANUP [rocky@localhost ~ /var/www]$ rm -rf ips.shabbat Now, when you visit your community, you'll see that it loads itself through the shabbat.php script first, then if its not Shabbat, it redirects to the index.php page; otherwise it halts execution of the request and displays the observance notice. Uninstall To remove this package, simply remove the shabbat.php script. To prevent its zombie from returning, remove the DirectoryIndex line in the .htaccess file. Support If you wish to modify this plugin, submit a pull request. Usage This plugin is free to use. It is 100% free to use and comes with no guarantees, assurances or ANYTHING OTHER THAN USE AT YOUR OWN RISK. The software is open source so you can see exactly what the script does, but always verify before trusting blindly. Why This Package Exists Some of you may be wondering why this package exists. I'll share with you the words that the Lord Yeshua Ha'Maschiah has shared with me, a sinning rack of dust whom Yeshua has saved.... "observance of the Sabbath is not a choice if you want favor with YeHoVah," thus observing the Sabbath is a choice not only for an individual to choose to make; but if you're a decision maker with authority over other people's lives; by asserting the observance of the Sabbath you are giving the Lord a chance to touch the hearts of the individual who reaches your community to return them to God so they too may have eternal Salvation in the transformative power of the Holy Ghost once you call upon the Ha'Maschiah, Our Yeshua. I built this upon His request for me, and this package exists because you are to use it if you feel a calling to observe the Sabbath for your community.
  4. #!/bin/bash set -e # Exit immediately if a command exits with a non-zero status [ "${DEBUG:-0}" == "1" ] && set -x # Enable debug mode set -u # Exit if an unset variable is used set -C # Prevent existing files from being overwritten using '>' [ "${VERBOSE:-0}" == "1" ] && set -v # Print shell input lines as read # Check for root privileges if [[ $EUID -ne 0 ]]; then echo "This script must be run with sudo" exit 1 fi # Get the actual user who ran sudo ACTUAL_USER="${SUDO_USER:-$USER}" ACTUAL_HOME=$(getent passwd "$ACTUAL_USER" | cut -d: -f6) PHPSTORM_HOME="${ACTUAL_HOME}/.jetbrains/phpstorm" PHPSTORM_SESSIONS="${PHPSTORM_HOME}/sessions" PHPSTORM_LOGS="${PHPSTORM_HOME}/logs" safe_exit() { local msg="${1:-UnexpectedError}" echo "${msg}" exit 1 } # Help if [[ "${1:-}" == "-h" || "${1:-}" == "help" || "${1:-}" == "--help" ]]; then cat << EOF Usage: ${0##*/} [version] [options] This script installs PhpStorm, an IDE by JetBrains for PHP development. It downloads the specified version of PhpStorm, verifies its checksum, and sets up a convenient execution shim. Arguments: version Specify the version of PhpStorm to download, e.g., '2024.3'. If not provided, defaults to the latest available version. Options: -h, --help, help Display this help and exit. Example: ${0##*/} 2024.3 # Install PhpStorm version 2024.3 ${0##*/} # Install the latest version of PhpStorm EOF exit 1 fi # Version handling default_version="2024.3" version="${1:-"${default_version}"}" version_regex='^[0-9]{4}\.[0-9]{1,2}$' if [[ ! $version =~ $version_regex ]]; then echo "Invalid version specified. Installing default version ${default_version}." read -r -p "Do you want to install PhpStorm ${default_version}? (y/n): " choice case "${choice}" in [Yy]*) version="${default_version}" ;; *) safe_exit "Installation cancelled." ;; esac fi # Create required directories with proper ownership install -d -m 755 -o "$ACTUAL_USER" -g "$ACTUAL_USER" \ "${PHPSTORM_HOME}" "${PHPSTORM_SESSIONS}" "${PHPSTORM_LOGS}" # Download and verify PhpStorm cd "${PHPSTORM_HOME}" phpstorm_tar="PhpStorm-${version}.tar.gz" checksum_file="${phpstorm_tar}.sha256" checksum_url="https://download.jetbrains.com/webide/${checksum_file}" tar_url="https://download-cdn.jetbrains.com/webide/${phpstorm_tar}" # Download checksum if [[ ! -f "${checksum_file}" ]]; then curl -f -L "${checksum_url}" -o "${checksum_file}" || safe_exit "Failed to download ${checksum_url}" chown "$ACTUAL_USER:$ACTUAL_USER" "${checksum_file}" fi # Download tarball if [[ ! -f "${phpstorm_tar}" ]]; then curl -f -L "${tar_url}" -o "${phpstorm_tar}" || safe_exit "Failed to download ${tar_url}" chown "$ACTUAL_USER:$ACTUAL_USER" "${phpstorm_tar}" fi # Verify checksum local_checksum="$(sha256sum "${phpstorm_tar}" | awk '{print $1}')" upstream_checksum="$(awk '{print $1}' "${checksum_file}")" if [[ "${upstream_checksum}" != "${local_checksum}" ]]; then echo "DANGER! Checksums do not match!" echo "${phpstorm_tar} = ${local_checksum}" echo "${checksum_url} = ${upstream_checksum}" rm -f "${checksum_file}" "${phpstorm_tar}" exit 1 fi # Extract PhpStorm tar -zxf "${phpstorm_tar}" rm -f "${phpstorm_tar}" "${checksum_file}" # Create latest symlink phpstorm_dir=$(find . -maxdepth 1 -type d -name "PhpStorm-*" | head -n 1) [[ -L "latest" ]] && rm -f "latest" ln -s "${phpstorm_dir}" "latest" # Fix ownership of all installed files chown -R "$ACTUAL_USER:$ACTUAL_USER" "${PHPSTORM_HOME}" # Create the shim file first in a temporary location TMP_SHIM=$(mktemp) [ -f "${TMP_SHIM}" ] && sudo rm -rf "${TMP_SHIM}" cat > "${TMP_SHIM}" << 'EOF' #!/bin/bash PHPSTORM_HOME="${HOME}/.jetbrains/phpstorm" PHPSTORM_SCRIPT="${PHPSTORM_HOME}/latest/bin/phpstorm.sh" PHPSTORM_SESSIONS="${PHPSTORM_HOME}/sessions" PHPSTORM_LOGS="${PHPSTORM_HOME}/logs" # Ensure directories exist mkdir -p "${PHPSTORM_SESSIONS}" "${PHPSTORM_LOGS}" # Clean old logs (90+ days or 1GB+ files older than 7 days) cleanup_logs() { find "${PHPSTORM_LOGS}" -type f -name '*.log' -mtime +90 -delete large_files=$(find "${PHPSTORM_LOGS}" -type f -name '*.log' -mtime +7 -size +1G) if [ -n "$large_files" ]; then echo "Found large log files older than 7 days and larger than 1GB:" echo "$large_files" read -t 12 -p "Delete these files? (yes/no): " response if [ "$response" = "yes" ]; then echo "$large_files" | xargs rm -f echo "Large log files deleted." fi fi } cleanup_logs # Launch PhpStorm LOG_FILE="${PHPSTORM_LOGS}/$(date +'%Y.%m.%d.%H.%M.%S').log" nohup "${PHPSTORM_SCRIPT}" "$@" > "${LOG_FILE}" 2>&1 & EOF # Move the shim to its final location with proper permissions install -m 755 "${TMP_SHIM}" "/usr/local/bin/phpstorm" rm -f "${TMP_SHIM}" echo "PhpStorm ${version} has been installed successfully!" echo "You can start PhpStorm by running 'phpstorm' from any directory."
  5.  
×
×
  • Create New...