PRETRANS
<lua>
-- see https://bugzilla.redhat.com/show_bug.cgi?id=1038092 for whole issue
-- see https://bugzilla.redhat.com/show_bug.cgi?id=1290388 for pretrans over pre
-- if copy-jdk-configs is in transaction, it installs in pretrans to temp
-- if copy_jdk_configs is in temp, then it means that copy-jdk-configs is in transaction and so is
-- preferred over one in %{_libexecdir}. If it is not in transaction, then depends
-- whether copy-jdk-configs is installed or not. If so, then configs are copied
-- (copy_jdk_configs from %{_libexecdir} used) or not copied at all
local posix = require "posix"
if (os.getenv("debug") == "true") then
debug = true;
print("cjc: in spec debug is on")
else
debug = false;
end
SOURCE1 = "/var/lib/rpm-state//copy_jdk_configs.lua"
SOURCE2 = "/usr/libexec/copy_jdk_configs.lua"
local stat1 = posix.stat(SOURCE1, "type");
local stat2 = posix.stat(SOURCE2, "type");
if (stat1 ~= nil) then
if (debug) then
print(SOURCE1 .." exists - copy-jdk-configs in transaction, using this one.")
end;
package.path = package.path .. ";" .. SOURCE1
else
if (stat2 ~= nil) then
if (debug) then
print(SOURCE2 .." exists - copy-jdk-configs already installed and NOT in transaction. Using.")
end;
package.path = package.path .. ";" .. SOURCE2
else
if (debug) then
print(SOURCE1 .." does NOT exists")
print(SOURCE2 .." does NOT exists")
print("No config files will be copied")
end
return
end
end
arg = nil ; -- it is better to null the arg up, no meter if they exists or not, and use cjc as module in unified way, instead of relaying on "main" method during require "copy_jdk_configs.lua"
cjc = require "copy_jdk_configs.lua"
args = {"--currentjvm", "java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386", "--jvmdir", "/usr/lib/jvm", "--origname", "java-latest-openjdk", "--origjavaver", "18", "--arch", "i386", "--temp", "/var/lib/rpm-state//java-latest-openjdk.i386"}
cjc.mainProgram(args)
POSTIN
/bin/sh
/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/java -Xshare:dump >/dev/null 2>/dev/null
update-desktop-database /usr/share/applications &> /dev/null || :
/bin/touch --no-create /usr/share/icons/hicolor &>/dev/null || :
# see pretrans where this file is declared
# also see that pretrans is only for non-debug
if [ ! "" == "-slowdebug" ]; then
if [ -f /usr/libexec/copy_jdk_configs_fixFiles.sh ] ; then
sh /usr/libexec/copy_jdk_configs_fixFiles.sh /var/lib/rpm-state//java-latest-openjdk.i386 /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386
fi
fi
exit 0
POSTUN
/bin/sh
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
upgrade1_uninstal0=$post_state
if [ "0$upgrade1_uninstal0" -gt 0 ] ; then # removal of this condition will cause persistence between uninstall
# warning! alternatives are localised!
# LANG=cs_CZ.UTF-8 alternatives --display java | head
# LANG=en_US.UTF-8 alternatives --display java | head
function nonLocalisedAlternativesDisplayOfMaster() {
LANG=en_US.UTF-8 alternatives --display "$MASTER"
}
function headOfAbove() {
nonLocalisedAlternativesDisplayOfMaster | head -n $1
}
MASTER="java"
LOCAL_LINK="/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/java"
FAMILY="java-latest-openjdk.i386"
rm -f /var/lib/rpm-state/"$MASTER"_$FAMILY > /dev/null
if nonLocalisedAlternativesDisplayOfMaster > /dev/null ; then
if headOfAbove 1 | grep -q manual ; then
if headOfAbove 2 | tail -n 1 | grep -q java-18-openjdk ; then
headOfAbove 2 > /var/lib/rpm-state/"$MASTER"_"$FAMILY"
fi
fi
fi
fi
alternatives --remove "java" "/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/java"
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
upgrade1_uninstal0=$post_state
if [ "0$upgrade1_uninstal0" -gt 0 ] ; then # removal of this condition will cause persistence between uninstall
# warning! alternatives are localised!
# LANG=cs_CZ.UTF-8 alternatives --display java | head
# LANG=en_US.UTF-8 alternatives --display java | head
function nonLocalisedAlternativesDisplayOfMaster() {
LANG=en_US.UTF-8 alternatives --display "$MASTER"
}
function headOfAbove() {
nonLocalisedAlternativesDisplayOfMaster | head -n $1
}
MASTER="jre_openjdk"
LOCAL_LINK="/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
FAMILY="java-latest-openjdk.i386"
rm -f /var/lib/rpm-state/"$MASTER"_$FAMILY > /dev/null
if nonLocalisedAlternativesDisplayOfMaster > /dev/null ; then
if headOfAbove 1 | grep -q manual ; then
if headOfAbove 2 | tail -n 1 | grep -q java-18-openjdk ; then
headOfAbove 2 > /var/lib/rpm-state/"$MASTER"_"$FAMILY"
fi
fi
fi
fi
alternatives --remove "jre_openjdk" "/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
upgrade1_uninstal0=$post_state
if [ "0$upgrade1_uninstal0" -gt 0 ] ; then # removal of this condition will cause persistence between uninstall
# warning! alternatives are localised!
# LANG=cs_CZ.UTF-8 alternatives --display java | head
# LANG=en_US.UTF-8 alternatives --display java | head
function nonLocalisedAlternativesDisplayOfMaster() {
LANG=en_US.UTF-8 alternatives --display "$MASTER"
}
function headOfAbove() {
nonLocalisedAlternativesDisplayOfMaster | head -n $1
}
MASTER="jre_18"
LOCAL_LINK="/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
FAMILY="java-latest-openjdk.i386"
rm -f /var/lib/rpm-state/"$MASTER"_$FAMILY > /dev/null
if nonLocalisedAlternativesDisplayOfMaster > /dev/null ; then
if headOfAbove 1 | grep -q manual ; then
if headOfAbove 2 | tail -n 1 | grep -q java-18-openjdk ; then
headOfAbove 2 > /var/lib/rpm-state/"$MASTER"_"$FAMILY"
fi
fi
fi
fi
alternatives --remove "jre_18" "/usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
upgrade1_uninstal0=$post_state
if [ "0$upgrade1_uninstal0" -gt 0 ] ; then # removal of this condition will cause persistence between uninstall
# warning! alternatives are localised!
# LANG=cs_CZ.UTF-8 alternatives --display java | head
# LANG=en_US.UTF-8 alternatives --display java | head
function nonLocalisedAlternativesDisplayOfMaster() {
LANG=en_US.UTF-8 alternatives --display "$MASTER"
}
function headOfAbove() {
nonLocalisedAlternativesDisplayOfMaster | head -n $1
}
MASTER="jre_18_openjdk"
LOCAL_LINK="/usr/lib/jvm/jre-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
FAMILY="java-latest-openjdk.i386"
rm -f /var/lib/rpm-state/"$MASTER"_$FAMILY > /dev/null
if nonLocalisedAlternativesDisplayOfMaster > /dev/null ; then
if headOfAbove 1 | grep -q manual ; then
if headOfAbove 2 | tail -n 1 | grep -q java-18-openjdk ; then
headOfAbove 2 > /var/lib/rpm-state/"$MASTER"_"$FAMILY"
fi
fi
fi
fi
alternatives --remove "jre_18_openjdk" "/usr/lib/jvm/jre-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386"
POSTTRANS
/bin/sh
if [ "x$debug" == "xtrue" ] ; then
set -x
fi
PRIORITY=00000001
if [ "" == "-slowdebug" ]; then
let PRIORITY=PRIORITY-1
fi
ext=.xz
key=java
alternatives \
--install /usr/bin/java $key /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/java $PRIORITY --family java-latest-openjdk.i386 \
--slave /usr/lib/jvm/jre jre /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386 \
--slave /usr/bin/alt-java alt-java /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/alt-java \
--slave /usr/bin/keytool keytool /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/keytool \
--slave /usr/bin/rmiregistry rmiregistry /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386/bin/rmiregistry \
--slave /usr/share/man/man1/java.1$ext java.1$ext \
/usr/share/man/man1/java-java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386.1$ext \
--slave /usr/share/man/man1/alt-java.1$ext alt-java.1$ext \
/usr/share/man/man1/alt-java-java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386.1$ext \
--slave /usr/share/man/man1/keytool.1$ext keytool.1$ext \
/usr/share/man/man1/keytool-java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386.1$ext \
--slave /usr/share/man/man1/rmiregistry.1$ext rmiregistry.1$ext \
/usr/share/man/man1/rmiregistry-java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386.1$ext
MASTER="$key"
FAMILY="java-latest-openjdk.i386"
ALTERNATIVES_FILE="/var/lib/rpm-state/$MASTER"_"$FAMILY"
if [ -e "$ALTERNATIVES_FILE" ] ; then
rm "$ALTERNATIVES_FILE"
alternatives --set $MASTER $FAMILY
fi
for X in openjdk 18 ; do
key=jre_"$X"
alternatives --install /usr/lib/jvm/jre-"$X" $key /usr/lib/jvm/java-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386 $PRIORITY --family java-latest-openjdk.i386
MASTER="$key"
FAMILY="java-latest-openjdk.i386"
ALTERNATIVES_FILE="/var/lib/rpm-state/$MASTER"_"$FAMILY"
if [ -e "$ALTERNATIVES_FILE" ] ; then
rm "$ALTERNATIVES_FILE"
alternatives --set $MASTER $FAMILY
fi
done
key=jre_18_openjdk
alternatives --install /usr/lib/jvm/jre-18-openjdk $key /usr/lib/jvm/jre-18-openjdk-18.0.0.0.37-0.rolling.2.mga8.i386 $PRIORITY --family java-latest-openjdk.i386
MASTER="$key"
FAMILY="java-latest-openjdk.i386"
ALTERNATIVES_FILE="/var/lib/rpm-state/$MASTER"_"$FAMILY"
if [ -e "$ALTERNATIVES_FILE" ] ; then
rm "$ALTERNATIVES_FILE"
alternatives --set $MASTER $FAMILY
fi