<commit_before>#!/bin/sh
###
# jdk.8.install.sh
# https://github.com/furplag/linux-config-tips
# Copyright 2016 furplag
# Licensed under MIT (https://github.com/furplag/linux-config-tips/blob/master/LICENSE)

# Automatically setting up to use Java.
# 1. Downloading JDK only use command-line.
# 2. Does not remove previous version of JDK, if "yum update jdk" runs.
# 3. Set "alternatives" for JDK.
# 4. Set $JAVA_HOME (relate to alternatives config).

# variables
resourceURL="http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.rpm"
resource=`echo $resourceURL | sed -e "s/^.*\///"`
installVer=`echo $resource | cut -d "-" -f 2 | cut -d "u" -f 1`
installUVer=`echo $resource | cut -d "-" -f 2 | cut -d "u" -f 2`
installJDK=1.$installVer.0_$installUVer
installRoot=/usr/java
priority=`echo $installJDK | sed -e "s/[\.]//g" | sed -e "s/_/0/"`

if [ ! ${EUID:-${UID}} = 0 ]; then echo -e "Permission Denied, Root user only.\nHint: sudo ${0}"; exit 0; fi

echo -e "Oracle JDK ${installVer}u${installUVer} install with \"alternatives java\".\n"

echo -e "\n  # Checking installed package named \"jdk1.${installVer}*\".\n"
if [ "${conflictPackage=$(rpm -qa jdk1.${installVer}}* | grep x86_64)}" ]; then
  conflictJDK=`echo $conflictPackage | cut -d "-" -f 2`
  conflictVer=`echo $conflictJDK | cut -d "." -f 2`
  conflictUVer=`echo $conflictJDK | cut -d "_" -f 2`
  if [ $installJDK = $conflictJDK ]; then
    echo "    JDK ${conflictVer}u${conflictUVer} already installed."
  elif [ 6 -gt $conflictVer ]; then
    echo "    Ah, we have encountered Prehistoric JDK now !\n"
  elif [ $installVer -gt $conflictVer ]; then
    echo "    previous version of JDK ${conflictVer}u${conflictUVer} has installed."
  elif [ $installVer -lt $conflictVer ]; then
    echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
  elif [ $installVer -eq $conflictVer ]; then
    if [ $installUVer -gt $conflictUVer ]; then
      echo "    previous version of JDK ${conflictVer}u${conflictUVer} has installed."
    else
      echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
    fi
  else
    echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
  fi
fi

exit

if [ $conflictPackage ]; then
  if [ $installJDK = $conflictJDK ]; then
    resourceURL=
  elif [ $installVer -eq $conflictVer ]; then
    if [ $installUVer -gt $conflictUVer ]; then
      echo "    update JDK ${conflictVer}u${conflictUVer} to JDK ${installVer}u${installUVer}."
    else
      echo "    does not install JDK ${installVer}u${installUVer}."
      resourceURL=<commit_msg>Update jdk.8.install.sh<commit_after>#!/bin/sh
###
# jdk.8.install.sh
# https://github.com/furplag/linux-config-tips
# Copyright 2016 furplag
# Licensed under MIT (https://github.com/furplag/linux-config-tips/blob/master/LICENSE)

# Automatically setting up to use Java.
# 1. Downloading JDK only use command-line.
# 2. Does not remove previous version of JDK, if "yum update jdk" runs.
# 3. Set "alternatives" for JDK.
# 4. Set $JAVA_HOME (relate to alternatives config).

# variables
resourceURL="http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.rpm"
resource=`echo $resourceURL | sed -e "s/^.*\///"`
installVer=`echo $resource | cut -d "-" -f 2 | cut -d "u" -f 1`
installUVer=`echo $resource | cut -d "-" -f 2 | cut -d "u" -f 2`
installJDK=1.$installVer.0_$installUVer
installRoot=/usr/java
priority=`echo $installJDK | sed -e "s/[\.]//g" | sed -e "s/_/0/"`

if [ ! ${EUID:-${UID}} = 0 ]; then echo -e "Permission Denied, Root user only.\nHint: sudo ${0}"; exit 0; fi

echo -e "Oracle JDK ${installVer}u${installUVer} install with \"alternatives java\".\n"

echo -e "\n  # Checking installed package named \"jdk1.${installVer}*\".\n"
if [ "${conflictPackage=$(rpm -qa jdk1.${installVer}}* | grep x86_64)}" ]; then
  conflictJDK=`echo $conflictPackage | cut -d "-" -f 2`
  conflictVer=`echo $conflictJDK | cut -d "." -f 2`
  conflictUVer=`echo $conflictJDK | cut -d "_" -f 2`
  if [ $installJDK = $conflictJDK ]; then
    echo "    JDK ${conflictVer}u${conflictUVer} already installed."
  elif [ 6 -gt $conflictVer ]; then
    echo "    Ah, we have encountered Prehistoric JDK now !\n"
  elif [ $installVer -gt $conflictVer ]; then
    echo "    previous version of JDK ${conflictVer}u${conflictUVer} has installed."
  elif [ $installVer -lt $conflictVer ]; then
    echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
  elif [ $installVer -eq $conflictVer ]; then
    if [ $installUVer -gt $conflictUVer ]; then
      echo "    previous version of JDK ${conflictVer}u${conflictUVer} has installed."
    else
      echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
    fi
  else
    echo "    newer version of JDK ${conflictVer}u${conflictUVer} has installed."
  fi
fi

if [ $conflictPackage ]; then
  if [ $installJDK = $conflictJDK ]; then
    resourceURL=
  elif [ $installVer -eq $conflictVer ]; then
    if [ $installUVer -gt $conflictUVer ]; then
      echo "    update JDK ${conflictVer}u${conflictUVer} to JDK ${installVer}u${installUVer}."
    else
      echo "    does not install JDK ${installVer}u${installUVer}."
      resourceURL=
{'fraction_non_alphanumeric': 0.1547119420068676, 'fraction_numerical': 0.01507058374666158, 'mean_word_length': 3.4850299401197606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '474112', 'n_tokens_mistral': 1982, 'n_tokens_neox': 1865, 'n_words': 531}