#!/bin/bash # A simple shell to build and install suhosin as module for PHP under # CentOS, Fedora and RHEL / Redhat Enterprise Linux servers. # ---------------------------------------------------------------------------- # Written by Vivek Gite <http://www.cyberciti.biz/> # (c) 2009 nixCraft under GNU GPL v2.0+ # ---------------------------------------------------------------------------- # Home page: http://www.hardened-php.net # Last updated: 15/June/2010 # ---------------------------------------------------------------------------- VERSION="-${2:-0.9.31}" URL="http://download.suhosin.org/suhosin${VERSION}.tgz" vURL="http://download.suhosin.org/suhosin${VERSION}.tgz.sig" FILE="${URL##*/}" vFILE="${vURL##*/}" DLHOME="/opt" SOFTWARE="suhosin" DEST="${FILE%.tgz}" [[ $(id -u) -ne 0 ]] && { echo "$0: You must be root user to run this script. Run it as 'sudo $0'"; exit 1; } getsoftware(){ wget $URL -O "${DLHOME}/$FILE" wget $vURL -O "${DLHOME}/$vFILE" } buildsoftware(){ [[ ! -f "${DLHOME}/$FILE" ]] && getsoftware cd "${DLHOME}" tar -zxvf $FILE cd "$DEST" phpize --clean && phpize && ./configure && make && read -p "Update/Install $SOFTWARE [Y/n] ? " answer shopt -s nocasematch [[ $answer =~ y|es ]] && make install shopt -u nocasematch } verifyfile(){ cd "${DLHOME}" [ ! -f ${DLHOME}/$vFILE ] && getsoftware md5sum -c $vFILE read -p "Continue to build [Y/n] ? " answer shopt -s nocasematch case "$answer" in y|yes) buildsoftware;; *) echo ""; esac shopt -u nocasematch } case "$1" in download) getsoftware ;; build) #verifyfile buildsoftware ;; verify) #verifyfile buildsoftware ;; *) echo "Usage: $0 {download|verify|build|upgrade} version" esac
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source, and DevOps topics via:
- RSS feed or Weekly email newsletter
- 2 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
This is really great use of functions and verifications. Love it.
jaysunn
Nice one :D
I love the verification process ;)