Compare commits
No commits in common. "6b8ef1118e14fb874f16b1f0cc5040f1f2faad49" and "dd5b59e4c57c9391b9cf7efc63b3350432192d5f" have entirely different histories.
6b8ef1118e
...
dd5b59e4c5
12
Dockerfile
12
Dockerfile
@ -5,5 +5,15 @@ RUN apt-get update && apt-get install -y \
|
|||||||
unzip \
|
unzip \
|
||||||
zip \
|
zip \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
RUN curl -s https://git.phoenix.ipv64.de/public/warp4j/raw/branch/feature/update_install_script/install | /bin/sh -s
|
RUN curl -fsSL -o /tmp/warp-packer \
|
||||||
|
https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer \
|
||||||
|
&& install -D \
|
||||||
|
--mode=755 \
|
||||||
|
--owner=root \
|
||||||
|
--group=root \
|
||||||
|
/tmp/warp-packer \
|
||||||
|
/usr/local/bin \
|
||||||
|
&& rm /tmp/warp-packer
|
||||||
|
WORKDIR /workdir
|
||||||
|
COPY warp4j /usr/local/bin/
|
||||||
ENTRYPOINT [ "/usr/local/bin/warp4j" ]
|
ENTRYPOINT [ "/usr/local/bin/warp4j" ]
|
||||||
|
114
install
114
install
@ -6,25 +6,19 @@ LOCATION=/usr/local/bin
|
|||||||
# exit top level program from subshell
|
# exit top level program from subshell
|
||||||
trap "exit 1" TERM
|
trap "exit 1" TERM
|
||||||
export TOP_PID=$$
|
export TOP_PID=$$
|
||||||
fail() {
|
function fail() {
|
||||||
kill -s TERM $TOP_PID
|
kill -s TERM $TOP_PID
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform IDs
|
# platform IDs
|
||||||
LIN=linux
|
LIN=linux
|
||||||
|
LIN_URL=https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760
|
||||||
MAC=macos
|
MAC=macos
|
||||||
|
MAC_URL=https://git.phoenix.ipv64.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f
|
||||||
WIN=windows
|
WIN=windows
|
||||||
# Urls
|
|
||||||
LIN_X64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-x64.warp-packer
|
|
||||||
LIN_AARCH64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer
|
|
||||||
MAC_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/macos-x64.warp-packer
|
|
||||||
|
|
||||||
# platform architecture
|
|
||||||
X64=x64
|
|
||||||
AARCH64=aarch64
|
|
||||||
|
|
||||||
# returns this platform ID
|
# returns this platform ID
|
||||||
get_this_platform() {
|
function get_this_platform() {
|
||||||
local this_platform="$(uname -s)"
|
local this_platform="$(uname -s)"
|
||||||
case $this_platform in
|
case $this_platform in
|
||||||
Linux*) echo $LIN ;;
|
Linux*) echo $LIN ;;
|
||||||
@ -36,111 +30,81 @@ get_this_platform() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# returns this platform architecture
|
|
||||||
get_this_architecture() {
|
|
||||||
local this_machine="$(uname -m)"
|
|
||||||
case $this_machine in
|
|
||||||
x86_64) echo $X64 ;;
|
|
||||||
aarch64) echo $AARCH64 ;;
|
|
||||||
*)
|
|
||||||
fail_with "Unsupported machine $this_machine"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# actually sets this platform
|
# actually sets this platform
|
||||||
THIS_PLATFORM=$(get_this_platform)
|
THIS_PLATFORM=$(get_this_platform)
|
||||||
|
|
||||||
# actually sets this architecture
|
|
||||||
THIS_ARCHITECTURE=$(get_this_architecture)
|
|
||||||
|
|
||||||
# fetches latest release download link for the platform
|
# fetches latest release download link for the platform
|
||||||
get_warp_link() {
|
function get_warp_link() {
|
||||||
local this_platform=$1
|
local this_platform=$1
|
||||||
local this_architecture=$2
|
|
||||||
|
|
||||||
if [ "$this_platform" = "$LIN" ]; then
|
if [ "$this_platform" = "$LIN" ]; then
|
||||||
echo "$LIN_URL"
|
echo "$LIN_URL"
|
||||||
if [ "$this_architecture" = "$X64" ]; then
|
else
|
||||||
echo "$LIN_X64_URL"
|
echo "$MAC_URL"
|
||||||
else
|
fi
|
||||||
echo "$LIN_AARCH64_URL"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$MAC_URL"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# downloads and installs single binary
|
# downloads and installs single binary
|
||||||
install() {
|
function install() {
|
||||||
local name=$1
|
local name=$1
|
||||||
local link=$2
|
local link=$2
|
||||||
local temp_location="/tmp/$name"
|
local temp_location="/tmp/$name"
|
||||||
echo "Downloading $name..."
|
echo "Downloading $name..."
|
||||||
curl -fsSL -o $temp_location $link
|
curl -fsSL -o "$temp_location" "$link"
|
||||||
if [ $? != 0 ]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "Error: Failed to download $name" >&2
|
echo "Error: Failed to download $name" >&2
|
||||||
fail
|
fail
|
||||||
fi
|
fi
|
||||||
echo "Creating $LOCATION/$name..."
|
echo "Creating $LOCATION/$name..."
|
||||||
su -c "install -D \
|
sudo install -D \
|
||||||
--mode=755 \
|
--mode=755 \
|
||||||
--owner=root \
|
--owner=root \
|
||||||
--group=root \
|
--group=root \
|
||||||
'$temp_location' '$LOCATION'"
|
"$temp_location" "$LOCATION"
|
||||||
if [ $? != 0 ]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "Error: Failed to install $name" >&2
|
echo "Error: Failed to install $name" >&2
|
||||||
fail
|
fail
|
||||||
fi
|
fi
|
||||||
rm $temp_location
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# returns missing dependencies
|
# returns missing dependencies
|
||||||
get_missing_deps() {
|
function get_missing_deps() {
|
||||||
if ! command -v awk > /dev/null 2<&1; then
|
local deps=(
|
||||||
echo -n "awk "
|
"awk" \
|
||||||
fi
|
"curl" \
|
||||||
if ! command -v curl > /dev/null 2<&1; then
|
"file" \
|
||||||
echo -n "curl "
|
"grep" \
|
||||||
fi
|
"sed" \
|
||||||
if ! command -v file > /dev/null 2<&1; then
|
"sort" \
|
||||||
echo -n "file "
|
"tar" \
|
||||||
fi
|
"unzip" \
|
||||||
if ! command -v grep > /dev/null 2<&1; then
|
"zip" \
|
||||||
echo -n "grep "
|
)
|
||||||
fi
|
for d in ${deps[@]}; do
|
||||||
if ! command -v sed > /dev/null 2<&1; then
|
if ! command -v $d &> /dev/null ; then
|
||||||
echo -n "sed "
|
echo -n "$d "
|
||||||
fi
|
fi
|
||||||
if ! command -v sort > /dev/null 2<&1; then
|
done
|
||||||
echo -n "sort "
|
|
||||||
fi
|
|
||||||
if ! command -v tar > /dev/null 2<&1; then
|
|
||||||
echo -n "tar "
|
|
||||||
fi
|
|
||||||
if ! command -v unzip > /dev/null 2<&1; then
|
|
||||||
echo -n "unzip "
|
|
||||||
fi
|
|
||||||
if ! command -v zip > /dev/null 2<&1; then
|
|
||||||
echo -n "zip"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/develop/warp4j"
|
WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j"
|
||||||
|
|
||||||
echo "Getting information about warp-packer releases..."
|
echo "Getting information about warp-packer releases..."
|
||||||
WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE)
|
WARP_LINK=$(get_warp_link $THIS_PLATFORM)
|
||||||
|
|
||||||
MISSING_DEPS=$(get_missing_deps)
|
MISSING_DEPS=$(get_missing_deps)
|
||||||
|
|
||||||
install "warp-packer" "$WARP_LINK" && \
|
install "warp-packer" "$WARP_LINK" && \
|
||||||
install "warp4j" "$WARP4J_LINK"
|
install "warp4j" "$WARP4J_LINK"
|
||||||
|
|
||||||
if [ -z "$MISSING_DEPS" ]; then
|
if [[ -z $MISSING_DEPS ]]; then
|
||||||
echo "Successfully installed"
|
echo "Successfully installed"
|
||||||
else
|
else
|
||||||
echo "Main tools successfully installed"
|
echo "Main tools successfully installed"
|
||||||
echo "Please install following with your package manager:"
|
echo "Please install following with your package manager:"
|
||||||
echo $MISSING_DEPS
|
for d in ${MISSING_DEPS[@]}; do
|
||||||
|
echo -n "$d "
|
||||||
|
done
|
||||||
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user