Code: Select all
sudo wget -qO php-update https://global-social.net/script/php-updaterCode: Select all
#!/usr/bin/env -S LC_CTYPE=C.UTF-8 LC_MESSAGES=C bash
# /usr/local/bin/php-updater
# version 2025-06-01 13:11 CEST 1748776292
#
# Copyright (c) 2023-2025 [ernolf] Raphael Gradenwitz
# Email raphael.gradenwitz<at>googlemail.com
# OpenPGP_Key 3EE43A84D2BA635A94E1033B0B145139A170715C
# (only for codesigning)
#
# This script may be freely used, modified, and distributed, provided
# that the original author, [ernolf] Raphael Gradenwitz, is credited.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# minified codeblocks in human readable format: https://github.com/ernolf/ebtb/tree/main/blocks
## bootstrap, whoami, whereami (minified)
[[ $* == *-q* ]]||printf '\e[?25l';trap "printf '\e[?25h'" 0;declare A CMA MD ME MP MS NUL=/dev/null REQ TTY=/dev/tty x;declare -a modules tdc bools args tntd jnr;declare -A B C D F I J M T V;declare -n TD=TMPDIR;_(){ return 1;};__(){ echo -e "\n\e[31mERROR: $1\e[0m\n">&2;exit 1;};dbg(){ :;};di(){ :;};C[e]=$(command -v env);for x in a:gawk b:basename c:cat cm:chmod co:chown cu:curl d:dirname fi:find f:flock g:grep h:head id jq md:mkdir mt:mktemp mv p:ps rp:realpath r:rm s:stat u:uname;do [ -x $(command -v ${x#*:}) ]&&C[${x%:*}]="${C[e]} LC_MESSAGES=C $(command -v ${x#*:})"||__ "'${x#*:}' binary not found.";done;C[md]+=" -p";C[mw]="${C[md]}m 777";C[ms]="${C[md]}m 1777";C[rr]="${C[r]} -fr --";C[r]+=" -f --";C[cm]+=" -f";C[cms]="${C[cm]} +t";C[co]+=" -R";A="$(${C[u]} -srvmpio)";for x in u un g gn G Gn;do I[$x]="$(${C[id]} -$x)";done;((${I[u]}))&&{ B[rt]=_;if [ ${I[un]} = www-data ];then I[l]=www-data;elif [[ "${I[Gn]} " =~ " sudo " ]];then I[l]=sudo_user;else I[l]=unprivileged_user;fi;}||B[rt]=: I[l]=root;readonly I;M[ap]="$(cd "$(${C[d]} "$0")"&&pwd)/${M[b]:=$(${C[b]} "$0")}";[[ $(command -v ${M[b]}) == ${M[ap]} ]]&&ME=${M[b]}||ME="${M[ap]}";MP=$(${C[rp]} ${M[ap]}) MD=$(${C[d]} $MP)
MS='php-updater' M[p]='ebtb' M[n]='php-updater' M[c]='prod' M[v]='2025-06-01 13:11 CEST' M[e]=1748776292 M[home]='https://global-social.net/apps/raw' M[pid]=$$
## create a neutral sandbox-homedir (minified)
${C[mw]} "${D[vt]:=/var/tmp/${M[p]}}"&&export HOME="${D[vt]}"&&cd;${C[ms]} "${D[vtm]:=${D[vt]}/modules}" "${D[vts]:=${D[vt]}/scripts}";${C[mw]} "${D[li]:=${D[vtm]}/${M[c]}}"
modules=(today interval dos2unix prompt fstring sort httpd context sysinf $MS/help nc/c2j nc/aio php/version php/nginx php/apache2 php/fpm php/versions php/alternatives php/extensions php/sury ask dist/os_release php.net/ini_directives $MS/inp $MS/pdiff $MS/merge $MS/diff $MS/pool $MS/tasks $MS/linstalled $MS/chfiles $MS/switch)
# when
printf -v T[rte] "%(%s)T" -2
## find a writable tempdir (minified)
: "${TD:=/tmp}";[[ $TD == '/' || ! -d $TD ]]&&TD='/tmp';[ -d "$TD" ]||{ for x in /run/user/${I[u]} /dev/shm /var/tmp ~/tmp;do [ -d "$x" ]&&{ TD="$x";break;};done;};TD="${TD%/}";[ -d "$TD" ]&&{ V[tsa]=$(${C[s]} -c %A $TD) V[w]=drwxrwxrwt;while :;do [[ $TD == */user/${I[u]} && $(${C[s]} -c %u%g $TD) == ${I[u]}${I[g]} ]]&&break;[[ $TD == */user && ${V[tsa]} == ${V[w]} ]]&&{ TD="$TD/${I[u]}";break;};[[ ${V[tsa]} == ${V[w]} ]]&&{ ${C[ms]} $TD/user;TD=$TD/user/${I[u]};};break;done;};${C[cms]} ${D[tu]:=${D[t]:=${TD%/user*}}/user};${C[ms]} ${D[tp]:=${D[t]}/${M[p]}} ${D[log]:=${D[tp]}/log} ${D[lu]:=/run/lock/user};[ -d "${D[t]}/user-${I[u]}" ]&&${C[mv]} "${D[t]}/user-${I[u]}" $TD;${C[md]}m 700 "$TD";[[ -n ${F[ttf]:=$(${C[mt]} -p $TD)} && -f ${F[ttf]} ]]&&${C[r]} "${F[ttf]}"||__ "TMPDIR '$TD' is not writable by user '${I[un]}'";unset F[ttf];D[td]=$TD
## general (minified)
q0(){ "$@" &>$NUL;};q1(){ "$@">$NUL;};q2(){ "$@" 2>$NUL;};mkld(){ ${C[md]} ${D[l]:=${D[lu]}/${I[u]}/${M[p]}};[[ -d ${D[l]} ]]||{ D[l]=${D[tu]}/lock;mkld;};};chrf(){ ${C[fi]} $1 -type d -exec ${C[cm]} 777 {} +;${C[fi]} $1 -type f -exec ${C[cm]} 666 {} +;${B[rt]}&&[[ $2 ]]&&${C[co]} $2:${3:-$2} $1;};fn_ln(){ local ln fn f t;read -r ln fn f <<<"$(caller ${1:-0})";t="$(${C[rp]} $f)";[[ $t == $MP ]]&&f="${M[n]}" t="${M[n]}";[[ $fn == main ]]&&fn=''||fn="$fn():";if [[ $t =~ /fd/ ]];then echo -n "$fn$ln:";elif [ "$t" = "$f" ];then echo -n "$f:$fn$ln:";else echo -n "$f->$t:$fn$ln:";fi;};trace(){ local f t;local -i i d;d=$((${#FUNCNAME[@]}-$((1+${2:-0}))));t='';for ((i=d; i>${1:-0}; i--));do f=$(fn_ln $i);((i==d))&&t="$f"||t+="->$f";done;printf '%s' "$t";};log(){ mkld;(${C[f]} -x 200;echo "$(ts) - ${M[b]}-${M[e]} - $(fp)$@">>"${F[log]:=${D[log]}/${M[b]}[uid:${I[u]}].log}") 200>"${D[l]}/log" 2>$NUL;};ts(){ printf "%(%s-(%F_%R_%Z))T";};fp(){ [ -f "${F[fp]:=${D[vt]}/fp}" ]&&printf "$(<${F[fp]})";printf "${M[pid]}:";};c(){ mkld;(${C[f]} -x 200;${C[cu]} --compressed "${@//NULL/\/dev\/null}") 200>"${D[l]}/cio" 2>$NUL;};hc(){ log "$(fn_ln)${V[astr]}${M[args]}";c -$1 NULL -w %{http_code} -A "$(fp;fn_ln)${V[astr]}${M[args]}" ${V[cargs]}/scripts/${M[n]}.json;};purge_li(){ [[ -d ${D[li]} ]]&&(set -eu;cd "${D[li]}"&&[[ $(pwd -P) == "/var/tmp/${M[p]}/modules"* ]]&&${C[fi]} . -mindepth 1 -type f ! -name 'modules.*' -exec ${C[r]} {} +) &>$NUL;return 0;};tabula_rasa(){ purge_li;};nohome(){ echo -e "\n\n\e[31m - Failed to load required module '$1'\n this can happen if the module server is down e.g. for maintenance\n try again later or run\n\n\e[37m sudo\e[36m wget -O $MP ${M[url]}\n\n\e[31m and start the script again.\e[0m\n">$TTY;kill -TERM ${M[pid]};};sourced(){ local -u m;shopt -s extglob;eval 'm="${1/+(.d|apt|deb|dist|nc|php)\//_}_bashlib"';shopt -u extglob;m="${m##*/}";q0 declare -p "$m"||declare -g "$m"=_;${!m};};json_etag(){ [ -f "$1" ]||return 1;[[ -v C[jq] || -v X[jq] ]]&&q2 ${C[jq]:-${X[jq]:-}} -r '.etag' "$1"||return 1;};module_etag(){ q2 ${C[jq]:-${X[jq]:-jq}} -r '.modules[]|select(.name=="'$1'")|.etag' $2;};c4u(){ local -u m="${1#*/}_BASHLIB";[ -f "${D[li]}/$1" ]||return 0;local -i le=$(module_etag "$1" "${F[lmj]}") re=$(module_etag "$1" "${F[lmjn]}");((le<re))&&{ ${C[r]} "${D[li]}/$1";declare -g $m=_;};};req(){ sourced $1||{ local mc=$(c -A "$(fp;fn_ln)req $1" ${V[cargs]}/${D[ri]}/$1);[ "${mc:0:9}" = "# BASHLIB" ]&&{ ${C[c]} <<MC
$mc
MC
}||nohome "$1";};};require(){ req $@;};lreq(){ local m=${D[li]}/$1;if [ -f $m ];then sourced $1||${C[c]} $m;elif (($(${C[md]} -p $(${C[d]} $m);c -o $m -w %{http_code} -A "$(fp;fn_ln)REQ $1" ${V[cargs]}/${D[ri]}/$1)==200))&&[ "$(${C[h]} -c9 $m 2>&1)" = "# BASHLIB" ];then log $(fn_ln)REQ $1;${C[c]} $m;else nohome $1;fi;};lrequire(){ lreq $@;};V[astr]="${I[l]}: " M[url]=${M[home]%/apps/raw}/script/${M[n]} V[cargs]="-se ${M[b]}-${M[e]} ${M[home]}";bools=(quiet silent pager check run2 irun2 do_update do_restore_backup do_integrity_check firstrun);for x in ${bools[@]};do B[$x]=_;done;${B[bgjobs]:=:}&&{ [[ -t 1 && ! -p /dev/stdout ]]||B[pager]=:;};for x in "$@";do x=${x//[‐‑–—﹣-]/-};case "$x" in -q|--quiet)B[quiet]=: B[silent]=: B[pager]=: TTY=/dev/null;;json=*)B[run2]=: J[o]="${x#*=}" V[astr]="run2 ${V[astr]}";;irun2)B[irun2]=: V[astr]="irun2 ${V[astr]}";;my_update)B[do_update]=: V[astr]="update ${V[astr]}";;restore_backup)B[do_restore_backup]=: V[astr]="backup ${V[astr]}";;integrity_check)B[do_integrity_check]=: V[astr]="integrity ${V[astr]}";;--firstrun)B[firstrun]=:;;--trace)B[trace]=:;;*)[ -z "${x// /}" ]||args+=("$x");esac;done;set -- "${args[@]}";args=();M[args]="$*";${B[run2]}&&q0 hc Io||{ mapfile -t jnr< <(hc D);((jnr[1]==200))&&J[o]="${jnr[0]}";};CMA="$ME json=${J[o]} ${M[args]}"
## include bashmodules (minified) ->
[[ ${M[c]} == test ]]&&T[w4uc]=30||T[w4uc]=300;D[ri]="modules/${M[c]}";${C[md]} "${D[li]}/$MS";REQ=". ${D[li]}" F[lmj]="${D[li]}/modules.json" F[rmj]="${D[ri]}/modules.json" F[lcf]="${D[li]}/$MS/.checked";F[lmjn]="${F[lmj]}~new" T[lce]=$(q2 ${C[c]} "${F[lcf]}"||:);((T[rte]-T[lce]>T[w4uc]))&&{ c -o ${F[lmjn]} -A "$(fp;fn_ln)$A" ${V[cargs]}/${F[rmj]}&&q0 chrf ${D[li]} 0;if T[mje]=$(json_etag ${F[lmj]})&&T[mjne]=$(json_etag ${F[lmjn]});then ((T[mje]<T[mjne]))&&B[check]=:;fi;};for x in binaries fp filter mh cleanup basics awksed exit tempfile ansi prefix button debug anykey line array menu ask sudo spinner dpkg dependency vdir gpg integrity ${modules[@]};do ${B[check]}&&{ ${B[pager]}||printf "\r\e[K.. checking modules - $x";c4u "$x";}||{ ${B[pager]}||printf "\r\e[K.. loading modules - $x";};. <(lreq $x);done;${B[check]}&&echo ${T[rte]}>"${F[lcf]}";[[ -f ${F[lmjn]} ]]&&${X[mv]} ${F[lmjn]} ${F[lmj]};${B[rt]}&&! ((T[lce]))&&echo ${T[rte]}>"${F[lcf]}";${B[pager]}||te1;eval "$(echo "$(unquote ${J[o]})"|${X[jq]:-${C[jq]:-jq}} -r 'keys[] as $key|"J[\($key[0:1])]=\(.[$key]|@sh)"')";V[upinf]='(no update info available)';. <(req update);"${B[do_update]}"&&my_update;[[ ${1:-} == my_update_check ]]&&my_update_check;"${B[do_restore_backup]}"&&restore_backup
# check module integrity and remove tainted modules (minified)
[ -f "${F[lmj]}" ]||c -o "${F[lmj]}" -A "$(fp;fn_ln)$A" ${V[cargs]}/${F[rmj]};q2 ${X[jq]:-${C[jq]:-jq}} -r '.modules[] | "\(.hash) \(.name)"' ${F[lmj]}>${D[li]}/modules.sha256;q0 chrf ${D[li]} 0;cd ${D[li]};tntd=($(q2 ${X[sha256sum]} -c --ignore-missing --quiet modules.sha256|sed_ 's/:.*//'));((${#tntd[@]}))&&{ for x in ${tntd[@]};do ${C[r]} "$x"||B[r]=_;done;${B[r]:-:}&&exec $CMA;};cd;q0 chrf ${D[li]} 0
## <- include bashmodules end #
contribute_(){
. <(require contribute)
contribute "https://help.nextcloud.com/t/php-updater-a-script-to-upgrade-php-in-a-safe-way/180215"
}; donate_(){ contribute_;}
[[ "$@" =~ (donat|contrib) ]] && contribute_
declare flag bool
declare -a flags bools args
declare -A FLAG
flags=(forceflag)
bools=(help nopager force needforce supported unsupported nolts distrib_to_old distrib_to_new distrib_unknown)
for flag in ${flags[@]}; do FLAG[$flag]=_; done; unset -v flag flags
for bool in ${bools[@]}; do B[$bool]=_; done; unset -v bool bools
FLAG[forceflag]=''
shopt -s extglob
for arg in "$@"; do
case "$arg" in
--help|-h) B[help]=: ;;
--force) B[force]=: FLAG[forceflag]=' --force' ;;
--no?([_-])pager) B[nopager]=: ;;
*) args+=("$arg")
esac
done
shopt -u extglob
set -- "${args[@]}"&&unset -v args
${B[help]} && explain
cursor_ hide
## it starts here:
# you MUST be root:
su_root "to run this script."
check_context
my_update_check
tnh1_strg distrib_checked || . <(require $MS/distrib)
tnh1_strg supported && B[supported]=:
tnh1_strg to_old && { B[distrib_to_old]=: B[needforce]=:; ${B[force]} && B[supported]=:;}
tnh1_strg to_new && { B[distrib_to_new]=: B[needforce]=:; ${B[force]} && B[supported]=:;}
tnh1_strg nolts && { B[nolts]=: B[needforce]=:; ${B[force]} && B[supported]=:;}
tnh1_strg unknown && { B[distrib_unknown]=: B[needforce]=:; ${B[force]} && B[supported]=:;}
tnh1_strg unsupported && B[unsupported]=:
# messages
call_help(){ o2; GRAY; echo "You can call the help with:$(o 35; B)$ME --help"; line '-' dP 2/78; }
call_me(){
require_arg $@
o2; GRAY; echo "You can call this list with:$(o 35; B)$ME --list-$1"; line '-' dP 2/78 a${2:-1}
}
version_mismatch(){
f
bundle echo " $(Pbg; pf)A version mismatch has been detected which cannot be resolved by this script$(pf; N)"
exit1
}
wrong_first_argument(){
required_args 2 $@
local first
local -i a
a=$2
f
first=" $(Pbg; pf)First argument must be the version of an installed php but"
if (( a )); then
bundle echo "$first php$1 is not installed$(pf; N)"
f
list_candidates
call_me candidates
call_help
f
else
bundle echo "$first \"$1\" is not an existing php version$(pf; N)"
list_existing
call_me existing
call_help
f
fi
exit1
}
does_not_exist(){
require_arg $@
f
bundle echo " $(Pbg; pf)\"$1\" is not an existing php version$(pf; N)"
list_existing
call_me existing
call_help
f
anykey
}
no_candidate(){
require_arg $@
f
bundle echo " $(Pbg; pf)Version \"$1\" cannot be installed with your Apt sources$(pf; N)"
f
list_candidates
call_me candidates
anykey_noquit
need_sury_repo
call_help
f
anykey
}
no_higher_candidate(){
f
bundle echo "$(pf)The installed PHP version (${PHP[v]}) is the highest available from your configured apt sources."
list_candidates
call_me candidates
anykey_noquit
need_sury_repo
downgrade_possible
anykey
}
need_ppa(){ need_sury_repo; }
downgrade_possible(){ bundle echo "$(pf)However, it is possible to downgrade to a lower version using this script"; }
## void ##
declare lang=$(echo "$LANG" | ${X[cut]} -d'_' -f1)
declare OLD NEW SUGGESTION PKG PKGOLD PKGNEW SAPI DEFAULT_ANSWER FILE
[[ -f "${F[php]:=${D[vt]}/php}" ]] && . "${F[php]}"
${B[supported]} && apt_need_update
# $1=old;$2=new
case "${1:-:}" in
--list-installed)
list_installed 'quiet=:'
exit 0
;;
--list-installed-only)
list_installed 'only=:'
exit 0
;;
--list-sapi)
list_installed_sapi
exit 0
;;
--list-candidates)
# list_candidates
# anykey_noquit
need_sury_repo
exit 0
;;
--list-existing)
list_existing
exit 0
;;
--switch-version)
${B[supported]} && switch_default_version
exit 0
;;
--list-debian)
. <(require dist/debian)
list_supported_debian
exit 0
;;
--list-ubuntu)
. <(require dist/ubuntu)
list_supported_ubuntu
exit 0
;;
-*) bundle echo "unknown option $1"
anykey
;;
*) :
esac
if [[ ${B[supported]} && $# -eq 2 && 0$(${X[phpquery]} -V | ${X[wc]} -w) -gt 1 ]]; then
(does_exist_ "${1//php/}" 1 && does_exist_ "${2//php/}" 0) && OLD="${1//php/}" NEW="${2//php/}" || explain
fi
if ${B[supported]}; then
if [ 0$(${X[phpquery]} -V | ${X[wc]} -w) -eq 1 ]; then
[ "$(${X[phpquery]} -V)" = "${PHP[v]}" ] || version_mismatch
OLD="$(${X[phpquery]} -V)"
separator
f
mh "$(fn_ln) only one php version ($OLD) found."
echo "$(ipf; W; format_string "Only one php version ($(C)$OLD$(W)) found, which is the thinkable best possible starting situation for this script. Simply follow the instructions and recommendations to install a new PHP version if possible, which then will adopt the settings of this PHP version by the means of this script." 3; N)"
f
anykey
separator
ext_state cleanup
ext_state fix
list_installed
anykey
separator
# list_candidates
# call_me candidates
# anykey_noquit
# separator
need_sury_repo
. "${F[php]}"
anykey
separator
if ask "$(qpf)Do you want to install a new php-version now" "$YES"; then
SUGGESTION="$(i_ver "$OLD")" || { no_higher_candidate;SUGGESTION="$(d_ver "$OLD")"; }
rs1="$(o3)please enter a new, not yet installed php-version…"
list_candidates
while :; do
cursor_ show
read -rp "$(bundle echo "E: Please enter the version string you want to install (e.g. '$SUGGESTION')"): " NEW
mh "$(fn_ln) input: $NEW"
if [ -z "$NEW" ]; then
echo "$rs1"
anykey
continue
elif [ "$NEW" = "$OLD" ]; then
bundle echo "$(es3; format_string "You entered: $NEW $(dY)from the point of view of this script, php$NEW is already installed" 3; N)"
echo "$rs1"
anykey
continue
fi
cursor_ hide
sbnc=''
if does_exist_ "$NEW" 0; then
. "${F[php]}"
[[ " ${CAN[@]} " =~ " $NEW " ]] && sbnc=" $(dY)supported by Nextcloud version $(listify_ C dY $(A_fld EXG ';' $NEW 4))"
bundle echo "$(es3)You entered: $NEW$sbnc"
if [[ " ${CAN[@]} " =~ " $NEW " ]]; then
ask "$(qpf)Are you ready to install php$NEW" "$YES" && break || exit1
else
no_candidate "$NEW"
fi
fi
done
install_new_php "$OLD" "$NEW"
else
exit0
fi
elif [ -n "${NEW:-}" ]; then
if [[ " ${CAN[@]} " =~ " $NEW " ]]; then
ext_state cleanup
ext_state fix
list_installed 'lonly=:'
remove_unused_sapis
change_sapi
remove_dependency_packages
remove_meta_packages
kill_spinner
cursor_ hide
spinner C " . check_config() searching known configuration errors ." &
check_config "$OLD"
kill_spinner
if [[ "$(${X[phpquery]} -V)" =~ $NEW ]]; then
declare -a missing_new_packages
spinner C " . searching for php$NEW packages yet to be installed ." &
mapfile -t missing_new_packages< <(packages_diff "$OLD" "$NEW")
kill_spinner
if ((${#missing_new_packages[@]})); then
if ((${#missing_new_packages[@]}==1)); then
plu='is:' plu2='one:is' mnp_string="$(B)${missing_new_packages[0]}$(N)"
else
plu='ese:s' plu2='some:are' mnp_string="$(listify B ${missing_new_packages[@]})"
fi
separator O
bundle echo "$(pf; format_string "You entered \"$(Y)$OLD$(N)\" as old and \"$(Y)$NEW$(N)\" as new version. Although php$NEW is installed, ${plu2%:*} $(Y)php$NEW$(N) package${plu#*:} ${plu2#*:} still missing compared to $(Y)php$OLD$(N) and the minimum packages that are needed to run a server like Nextcloud. Th${plu%:*} ${plu2#*:} the missing one${plu#*:}:" 3)"
bundle echo "$(es3; format_string "$mnp_string" 3)"
o3; echo "If you answer $(box no) here, the script will continue without installing th${plu%:*} package${plu#*:}."
ask "$(qpf)Do you want to install th${plu%:*} package${plu#*:}" "$YES" && install_new_php "$OLD" "$NEW"
fi
else
separator O
bundle echo "$(pf; format_string "You entered \"$(Y)$OLD$(N)\" as old and \"$(Y)$NEW$(N)\" as new version. Since php$NEW is not yet installed at all, it will be installed from scratch." 3)"
ask "$(qpf)Are you ready to install php$NEW" "$YES" && install_new_php "$OLD" "$NEW" || exit1
fi
else
no_candidate "$NEW"
pf; exit1
fi
declare -a c_f_a # changed files array
spinner O " . searching changed ini- and conf-files for php$OLD to be adapted into php$NEW ." &
mapfile -t c_f_a< <(p_nosort $(changed_files_ ini "$OLD" "$NEW") $(changed_files_ conf "$OLD" "$NEW"))
kill_spinner
if (( ${#c_f_a[@]} )); then
for FILE in ${c_f_a[@]}; do
f
separator2 O
PKG=${FILE%:*} FILE=${FILE#*:}
[ -f "$FILE" ] || continue
if [ "$PKG" = "libapache2-mod-php$OLD" ]; then
PKGOLD="$PKG" SAPI="apache2"
elif [ "$PKG" = "libphp$OLD-embed" ]; then
PKGOLD="$PKG" SAPI="embed"
elif [ "$PKG" = 'embed' ]; then
PKGOLD="libphp$OLD-embed" SAPI="embed"
elif [ "$PKG" = "php$OLD-phpdbg" ]; then
PKGOLD="$PKG" SAPI="phpdbg"
elif [ "$PKG" = 'phpdbg' ]; then
PKGOLD="php$OLD-phpdbg" SAPI="phpdbg"
else
PKGOLD="php$OLD-$PKG" SAPI="$PKG"
fi
PKGNEW="${PKGOLD/$OLD/$NEW}"
preq="$(qpf; P; format_string "Do you want to migrate the values for the $(B)${DESCR[$SAPI]}$(P) from the$(C) $(${X[basename]} $FILE)$(P) for $(Y)$PKGOLD$(P) into the corresponding$(C) $(${X[basename]} $FILE)$(P) for$(Y) $PKGNEW" 3; N)"
if ask "$preq" "$YES"; then
separator O
merge_settings "$OLD" "$NEW" "$PKGOLD" "$FILE" "$SAPI"
fi
done
fi
check_fpm_pool_files "$OLD" "$NEW"
declare -a o_c_f_a # other changed files array
spinner C " . searching other changed files for php$OLD to be adapted into php$NEW ." &
mapfile -t o_c_f_a< <(p_nosort $(changed_files_ other "$OLD" "$NEW"))
kill_spinner
if (( ${#o_c_f_a[@]} )); then
for FILE in ${o_c_f_a[@]}; do
separator O
PKG=${FILE%:*} FILE=${FILE#*:}
f
diff_other_files
done
fi
separator
echo "$(pf; format_string "The migration of the settings from php-$OLD to php-$NEW is now completed, unless you have deliberately left out files or settings. These can be made up at any time with:" 3)"
f
echo "$(G; prompt; lB) $ME${FLAG[forceflag]}$(C) "$OLD" "$NEW""; N
f
echo "$(O; pf; format_string "You now can switch the php version from $(C)php-$OLD$(O) to $(C)php-$NEW$(O) for the commandline and your webserver. Therefore call:" 3; N)"
f
echo "$(G; prompt; P) $ME${FLAG[forceflag]} --switch-version"; N
f
O; echo " or run it now:"; N
if ask "$(qpf)Do you want to switch the php version now" "$YES"; then
exec $ME${FLAG[forceflag]} json=${J[o]} --switch-version
else
contribute_
fi
exit 0
else # if [ $# -ne 2 ]; then
first_brief_help "Brief help:"
f 2
anykey
separator
ext_state cleanup
ext_state fix
kill_spinner
list_installed
f
anykey
separator
# list_candidates
# call_me candidates
# anykey_noquit
# separator
need_sury_repo
anykey
separator
f
brief_help "this would be possible calls:"
N
f
exit0
fi
else
f
bundle echo "$(lB; pf; format_string "Your distribution is marked as not fully supported. The script is running in $(lG)safe mode$(lB) and will only provide informations about your system but will make no changes to your system$(${B[needforce]} && bundle echo -n " unless you call it with $(GRAYbg)[ --force ]"; N)" 3)"
f
anykey
separator
list_installed
anykey
separator
# list_candidates
# call_me candidates
# anykey_noquit
# separator
need_sury_repo
anykey
separator
ask "$(qpf)Do you want to read the help" "$YES" && explain
N
f
exit0
fi
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEPuQ6hNK6Y1qU4QM7CxRROaFwcVwFAmg8NjIACgkQCxRROaFw
cVwjMRAAlPhqaWsOcthoXVx3uGG03yN+cGxFiR7ChCTWosl5uplZDFes44V6WwyM
jdpgKAox+Cc1CpLGlpWZ7tJPgDjEBf/HT3QloD7/FYNpNx6DFYjr3CV4bit0qZ6/
vUJOL05tlInw+EcNcfOhQ6VTurr+fL2MUQ5KEq5q00rX8uSTgHKdaqJG18apr371
XWuA3MfmeIGrqnuJQbJBhOWigVoAREjoz8kn2Hv3kJP6vWpglrk75btDVDHkk6yz
85+6w90j8Z95IvdrAxrk1Ri7QziJJ7zc+Y1TFLTbNOUVRQHa52DAPz5su6/2pOnJ
Yj//whSFjsvUiswkJTQE9d4kJr0kSvisv6aLx9mtkwAeVyscPut4voQs/kmnW0mk
FQhGGxMMuYBW/OVcyH8QEGYVNlNi0QE2MADYbjXwhTMzHx/7Vr+Aum3ySIE4TVuz
cIWo7homwMzozd19Shjos7oVXtN5pKEbP6rgzuqvIECcbqmrBBRRe0K2nAhRdbYE
6/zEpsivYGSkqjlxCJAJ/5+Wl69grnVHvpaghFjxdZdChxjlHGSaEuJuh9Gv3OEW
b2GU/evtU5Pq45UJGzCxaoKSNKV1/3rtd4Q5T60s1vd2mQ2+YSaeGaktI5zFgEBP
FRdmGBJ2/gONbu+Q5+qGcrUnjlye87Z8jiIcjnGXmqC8uuW/Fu8=
=1t19
-----END PGP SIGNATURE-----
v=false
# sha256sum: 2ba7b853ff792e5c7857c42470a88865e73b0f2fe7f74c811f1023e6980e10b8