Background Image

DOCUMENTATION

?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

Author: Sungjin Kim

 

If you install CUBRID-10.x.x.xxxx-d56a158-Linux.x86_64.sh which is the version for Linux from 10.1 version. The default installation directory is very long, and it will look like the picture below.

sh_install.png

It is quite inconvenient if the directory name is long when performing maintenance or the corresponding console. Therefore, let's modify the installation package to be installed with CUBRID as in the previous version.

 

First of all, the structure of the package.sh file for the Linux version is as follows; and if you open it with vi, it consists of the top shell script + the bottom tar with gzip.

sh_install2.png

 

So, let's separate the script part and the tar+gz part.

There are following hints in the script:

# take the archive portion of this file and pipe it to tar
# the NUMERIC parameter in this command should be one more
# than the number of lines in this header file
# there are tails which don't understand the "-n" argument, e.g. on SunOS
# OTOH there are tails which complain when not using the "-n" argument (e.g. GNU)
# so at first try to tail some file to see if tail fails if used with "-n"
# if so, don't use "-n"
use_new_tail_syntax="-n"
tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
 
tail $use_new_tail_syntax +613 "$0" | gunzip | (cd "${toplevel}" && tar xf - 2> /dev/null) || cpack_echo_exit "Problem unpacking the CUBRID-10.2.0.8797-d56a158-Linux.x86_64"
 
echo "Unpacking finished successfully"
 
#
# post-setup for CUBRID

Line 526 is the separation between the script and tar+gz. Let's use this part to separate the shell script and tar+gz first. The reason for separation is that modifying the shell script source will change the number of lines. The separation method can be easily separated with a head command and a tail command.

[root@ ~]# head -612 CUBRID-10.2.0.8797-d56a158-Linux.x86_64.sh > install.sh
[root@ ~]# tail -n +613 CUBRID-10.2.0.8797-d56a158-Linux.x86_64.sh > cubrid.tgz

 

Now that we've separated it, let's modify the shell script for installation.

cpack_version
echo "This is a self-extracting archive."
toplevel="`pwd`"
if [ "x${cpack_prefix_dir}x" != "xx" ]
then
  toplevel="${cpack_prefix_dir}"
else
  toplevel="${toplevel}/CUBRID"
fi

Required: Adding the part as shown in line 71.  (please keep in mind that once added, the number of lines added is 2 lines.)

 

Not required: In addition, modify the part of the installation directory displayed on the screen.

 if [ "x${cpack_include_subdir}x" = "xx" ]
  then
    echo "By default the CUBRID will be installed in:"
    #echo "  \"${toplevel}/CUBRID-10.2.0.8797-d56a158-Linux.x86_64\""
    echo "  \"${toplevel}/\""
    echo "Do you want to include the subdirectory CUBRID-10.2.0.8797-d56a158-Linux.x86_64?"
    echo "Saying no will install in: \"${toplevel}\" [Yn]: "
    read line leftover
    cpack_include_subdir=TRUE
    case ${line} in
      n* | N*)
        cpack_include_subdir=FALSE
    esac
  fi

If you go to line 486, the default directory path has been changed at the top, but let's change it because the directory name is a constant value in the script.

Also, to keep the original, add # to the original line, change it to a comment, and replace it with echo "\"${toplevel}/\"". Due to this, the number of added lines is one line. Let's remember this!

 

Next, we need to modify the syntax for creating the actual directory.

This is the if clause just below, just described above. The line number is also displayed for reference.

if [ "x${cpack_include_subdir}x" = "xTRUEx" ]
then
  #toplevel="${toplevel}/CUBRID-10.2.0.8797-d56a158-Linux.x86_64"
  mkdir -p "${toplevel}"
fi

When mkdir, the syntax for creating the above directory, is specified as a constant value, the directory name is fixed. Let's change this.

 

 

Now, finally, edit the extract of tar+gz inside the shell script.

# take the archive portion of this file and pipe it to tar
# the NUMERIC parameter in this command should be one more
# than the number of lines in this header file
# there are tails which don't understand the "-n" argument, e.g. on SunOS
# OTOH there are tails which complain when not using the "-n" argument (e.g. GNU)
# so at first try to tail some file to see if tail fails if used with "-n"
# if so, don't use "-n"
use_new_tail_syntax="-n"
tail $use_new_tail_syntax +1 "$0" > /dev/null 2> /dev/null || use_new_tail_syntax=""
 
tail $use_new_tail_syntax +616 "$0" | gunzip | (cd "${toplevel}" && tar xf - 2> /dev/null) || cpack_echo_exit "Problem unpacking the CUBRID-10.2.0.8797-d56a158-Linux.x86_64"
 

The above section 613 is modified to 616. In the above installation shell script, the number of lines added by source modification is 3 lines, so you only need to adjust the number of lines added. If you haven't edited the screen output part above, it's 615.

 

Now let's put that part together like a real package. The merge is very simple.

[root@ ~]# cat cubrid.tgz >> install.sh

 

Now if we execute sh instal.sh, the CUBRID directory is installed as follows:

sh_install3.png


List of Articles
No. Category Subject Date
17 Server The Types of Error and Log Generated by CUBRID 2020.07.13
16 Tools Reverse Engineering CUBRID Database with ERwin file 2020.07.14
15 Tools Forward Engineering a Data Model with ERwin file 2020.07.14
14 Server Checking the Port Open Status with the CUBRID port and OS Command 2020.07.14
» Server Replace the Linux Version CUBRID Default Installation Directory 2020.07.14
12 Server The CUBRID’s Access_control (ACL) Feature 2020.07.15
11 Server Compressing Backup by Named Pipe 2020.07.17
10 Server Changing the LOB Data Path 2020.07.17
9 Server Using Two-way Encryption Functions with Java SP in CUBRID 2020.07.17
8 Server CUBRID GRANT ALL TABLES file 2020.07.17
Board Pagination Prev 1 2 3 4 Next
/ 4

Join the CUBRID Project on