Skip to content

Commit

Permalink
work-in-progress
Browse files Browse the repository at this point in the history
  • Loading branch information
iondev33 committed Oct 13, 2024
1 parent f337abe commit 9099f28
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ ion.log
.gitkeep
system_up
tests/*
.vscode/settings.json
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

- [ION-Core for Linux (and WSL)](#ion-core-for-linux-and-wsl)
- [Build \& Install](#build--install)
- [Manually get the ION Open Source Code and Build ion-core](#manually-get-the-ion-open-source-code-and-build-ion-core)
- [Automatically get the ION Open Source Code and Build ion-core](#automatically-get-the-ion-open-source-code-and-build-ion-core)
- [Alternative: Automated download of ION Open Source Code _without commit history_](#alternative-automated-download-of-ion-open-source-code-without-commit-history)
- [Selecting ION-core Features to Build](#selecting-ion-core-features-to-build)
- [Extension Blocks Build Options](#extension-blocks-build-options)
- [Man Page Installation](#man-page-installation)
Expand All @@ -17,7 +16,8 @@
- [Contributing Code](#contributing-code)
- [WSL2 Networking Issue](#wsl2-networking-issue)
- [Release Notes](#release-notes)
- [Tag(to be added): `4.1.3`](#tagto-be-added-413)
- [Tag: `4.1.3`](#tag-413)
- [Tag: `4.1.2b`](#tag-412b)
- [Tag: `4.1.2a`](#tag-412a)
- [Tag: `4.1.2`](#tag-412)

Expand All @@ -29,29 +29,33 @@ sudo apt update
sudo apt install make gcc
```

### Manually get the ION Open Source Code and Build ion-core

Get the ION Open Source Code:
Clone the ION open source code repo:
```bash
wget https://github.com/nasa-jpl/ION-DTN/archive/refs/tags/ion-open-source-4.1.3.tar.gz
tar -zxvf ion-open-source-4.1.3.tar.gz
cd <ion-source-codee-folder>
git clone https://github.com/nasa-jpl/ION-DTN.git
```

Get the ION-Core Repo, Extract Source File, Build and Install
Get ion-core and build:
```bash
git clone https://github.com/nasa-jpl/ion-core.git
cd ion-core
git checkout tags/4.1.3
./scripts/extract.sh ../ion-open-source-4.1.3
# clean out previous build
make clean
sudo make uninstall
# build
./scripts/extract.sh <your-ion-source-code-folder>/ion-open-source-4.1.3
make
sudo make install
```

### Automatically get the ION Open Source Code and Build ion-core
### Alternative: Automated download of ION Open Source Code _without commit history_

You can run `./scripts/extract.sh` without supplying the path to an existing ION source code repo. In that case, the script will automatically download the appropriate ION open source code into a `tmp` directory.

You can also run `./scripts/extract.sh` without supplying the path to an existing ION source code folder. In that case, the script will automatically download the appropriate ION open source code into a `tmp` directory and extract the needed files into ion-core.
Then you can run `make` and `sudo make install` to install the code.

Then run `make` and `sudo make install`.
The disadvantage of this approach is that you will not have the commit history of the ION open source code and not way to submit pull requests to the original ION open source code. This is provided as a convenience for conducting quick testing.

## Selecting ION-core Features to Build

Expand Down
57 changes: 27 additions & 30 deletions scripts/extract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ cd "$SCRIPT_DIR/.."

# Set the default source
ION_VER="4.1.3"
ION_SRC_URL=https://github.com/nasa-jpl/ION-DTN/archive/refs/tags/ion-open-source-$ION_VER.tar.gz
#ION_SRC_URL="https://sourceforge.net/projects/ion-dtn/files/ion-open-source-$ION_VER.tar.gz"
ION_SRC_ZIP=https://github.com/nasa-jpl/ION-DTN/archive/refs/tags/ion-open-source-$ION_VER.tar.gz
SOURCE_PATH=$1

if [[ -z "$1" ]]; then
Expand All @@ -41,14 +40,23 @@ if [[ -z "$1" ]]; then
mkdir -p "$SOURCE_PATH"
echo "No source path specified. ION $ION_VER will be downloaded to location: $SOURCE_PATH"
# Use wget to download the file
if wget "$ION_SRC_URL"; then
if wget "$ION_SRC_ZIP"; then
tar -xzf ion-open-source-$ION_VER.tar.gz -C "$SOURCE_PATH" --strip-components 1
rm ion-open-source-$ION_VER.tar.gz
echo "Download and extraction successful."
else
echo "Download failed."
exit 1
fi
else
# Use the provided source path
SOURCE_PATH=$1
echo "Using provided source path: $SOURCE_PATH"
# Check if the source path exists
if [[ ! -d "$SOURCE_PATH" ]]; then
echo "Source path does not exist. Please provide a valid source path."
exit 1
fi
fi

SRC=src
Expand Down Expand Up @@ -367,8 +375,8 @@ echo "Extracting source .c files from $SOURCE_PATH to $SRC"
count=0
while [ "x${SOURCES[count]}" != "x" ]
do
if cp "${SOURCES[count]}" $SRC
then echo found "${SOURCES[count]}"
if ln -s "${SOURCES[count]}" $SRC
then echo linked "${SOURCES[count]}"
else echo ERROR: "${SOURCES[count]}" is missing or has moved. Aborting.
break
fi
Expand All @@ -380,8 +388,8 @@ echo "Extracting header .h files from $SOURCE_PATH to $INC"
count=0
while [ "x${HEADERS[count]}" != "x" ]
do
if cp "${HEADERS[count]}" $INC
then echo found "${HEADERS[count]}"
if ln -s "${HEADERS[count]}" $INC
then echo linked "${HEADERS[count]}"
else echo ERROR: "${HEADERS[count]}" is missing or has moved. Aborting.
break
fi
Expand All @@ -394,8 +402,8 @@ echo "Extracting ION scripts from $SOURCE_PATH to $OUT_BIN"
count=0
while [ "x${SCRIPTS[count]}" != "x" ]
do
if cp "${SCRIPTS[count]}" $OUT_BIN
then echo found "${SCRIPTS[count]}"
if ln -s "${SCRIPTS[count]}" $OUT_BIN
then echo linked "${SCRIPTS[count]}"
else echo ERROR: "${SCRIPTS[count]}" is missing or has moved. Aborting.
break
fi
Expand All @@ -409,8 +417,8 @@ mkdir -p "$SRC/$MAN"
count=0
while [ "x${MANPAGE[count]}" != "x" ]
do
if cp "${MANPAGE[count]}" $SRC/$MAN/
then echo found "${MANPAGE[count]}"
if ln -s "${MANPAGE[count]}" $SRC/$MAN/
then echo linked "${MANPAGE[count]}"
else echo ERROR: "${MANPAGE[count]}" is missing or has moved. Aborting.
break
fi
Expand All @@ -422,8 +430,8 @@ echo "Extracting test scripts from $SOURCE_PATH to $TESTS"
count=0
while [ "x${TEST_SCRIPTS[count]}" != "x" ]
do
if cp "${TEST_SCRIPTS[count]}" $TESTS
then echo found "${TEST_SCRIPTS[count]}"
if ln -s "${TEST_SCRIPTS[count]}" $TESTS
then echo linked "${TEST_SCRIPTS[count]}"
else echo ERROR: "${TEST_SCRIPTS[count]}" is missing or has moved. Aborting.
break
fi
Expand All @@ -432,37 +440,26 @@ done

# Move testing script 'system_up'
echo "Place 'system_up' script in root directory"
cp $TESTS/system_up $TESTS/..
ln -s $TESTS/system_up $TESTS/..

# Extract Test Set
echo "Extracting test sets from $SOURCE_PATH to $TESTS"
count=0
while [ "x${TEST_DIRS[count]}" != "x" ]
do
if cp -r "${TEST_DIRS[count]}" $TESTS
then echo found "${TEST_DIRS[count]}"
if ln -s "${TEST_DIRS[count]}" $TESTS
then echo linked "${TEST_DIRS[count]}"
else echo ERROR: "${TEST_DIRS[count]}" is missing or has moved. Aborting.
break
fi
count=$(( $count + 1 ))
done

# Copy modified ION-core version of bpextension.c to /src
#
# Copy modified ION-core version of bpextension.c to original source code
# Modified bpextension.c support custom build options in build-list.mk
echo "Replacing bpextension with customized ion-core version in ./scripts"
cp $SCRIPT_DIR/bpextensions-ion-core.c ./$INC/bpextensions.c

# Clean up the inc/noextensions.c file here.
# The compiler produces "warning: excess elements in scalar initializer"
# This is because of the static type for the arrays:
# extensionDefs[]
# extensionSpecs[]

# This uses clean_noex.txt which contains some corrected code.
# Since I can't touch the upstream code on Sourceforge; I gotta do it this way for now.
##cd scripts
##./clean_noex.sh
##cd ..
cp --remove-destination $SCRIPT_DIR/bpextensions-ion-core.c ./$INC/bpextensions.c

# Relative path in #include:
echo "Updating path to header file bpsecadmin_config.h in file bpsec_policy_rule.c"
Expand Down

0 comments on commit 9099f28

Please sign in to comment.