Skip to content

Commit

Permalink
Simplify install
Browse files Browse the repository at this point in the history
Install GO via Port
Fix var into service management
  • Loading branch information
zorglube committed Sep 12, 2020
1 parent 2d35955 commit 482a52b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 47 deletions.
2 changes: 1 addition & 1 deletion includes/movienight
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ daemon_status() {
}

load_rc_config $name
: ${${name}_enable:=no}
: ${rcvar:=no}

run_rc_command "$1"
51 changes: 5 additions & 46 deletions movienight-jail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ JAIL_INTERFACES=""
DEFAULT_GW_IP=""
INTERFACE="vnet0"
VNET="on"
JAIL_NAME="movienight"
JAIL_NAME="movienight-test"
CONFIG_NAME="mn-config"
GO_DL_VERSION=""
UID="movienight"
Expand Down Expand Up @@ -114,7 +114,7 @@ fi
cat <<__EOF__ >/tmp/pkg.json
{
"pkgs":[
"nano","bash","gzip","ca_root_nss","git"
"nano","bash","gzip","ca_root_nss","git","lang/go"
]
}
__EOF__
Expand All @@ -140,45 +140,14 @@ iocage exec "${JAIL_NAME}" "pw user add ${UID} -c ${GID} -u ${UID_GID_ID} -d /no
#
#####
USR_LOCAL="/usr/local"
GO_URL="https://golang.org/dl/${GO_DL_VERSION}"
GO_PATH=${USR_LOCAL}"/go/bin"
ROOT_PROFILE="/root/.profile"
SHELL="/bin/bash"
OS=`uname`

if ! iocage exec "${JAIL_NAME}" fetch -o /tmp "${GO_URL}"
then
echo "Failed to download GO"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" tar xzf /tmp/"${GO_DL_VERSION}" -C "${USR_LOCAL}"
then
echo "Failed to extract GO"
exit 1
fi

cat "${INCLUDES_PATH}/${ENV_VAR_UPDATE}_base" | sed 's@GO_PATH@'"${GO_PATH}"'@g' | sed 's@OS_VAL@'"${OS}"'@g' > "${INCLUDES_PATH}/${ENV_VAR_UPDATE}"

INCLUDE_JAIL="/mnt/includes"

iocage exec "${JAIL_NAME}" mkdir -p ${INCLUDE_JAIL}
iocage fstab -a "${JAIL_NAME}" "${INCLUDES_PATH}" ${INCLUDE_JAIL} nullfs rw 0 0

if ! iocage exec "${JAIL_NAME}" chmod 775 ${INCLUDE_JAIL}/${ENV_VAR_UPDATE}
then
echo "Failed to update chmod 775"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" chmod +x ${INCLUDE_JAIL}/${ENV_VAR_UPDATE}
then
echo "Failed to update chmod +x"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" ${INCLUDE_JAIL}/${ENV_VAR_UPDATE}
then
echo "Failed to update enviroment vars"
exit 1
fi

if ! iocage restart "${JAIL_NAME}"
then
echo "Fail to restart Jail"
Expand All @@ -204,16 +173,6 @@ then
echo "Failed to download Movie Night"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" link ${GO_PATH}/go ${USR_LOCAL}/bin/go
then
echo "Failed link to GO"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" link ${GO_PATH}/gofmt ${USR_LOCAL}/bin/gofmt
then
echo "Failed link to GOFMT"
exit 1
fi
if ! iocage exec "${JAIL_NAME}" "make TARGET=${TARGET} ARCH=${ARCH} -f ${MN_MAKEFILE} -C ${MN_HOME}"
then
echo "Failed to make Movie Night"
Expand All @@ -226,12 +185,12 @@ then
exit 1
fi

iocage exec "${JAIL_NAME}" rm /tmp/"${GO_DL_VERSION}"
# iocage exec "${JAIL_NAME}" rm /tmp/"${GO_DL_VERSION}"

# Copy pre-written config files
iocage exec "${JAIL_NAME}" cp ${INCLUDE_JAIL}/movienight /usr/local/etc/rc.d/
iocage exec "${JAIL_NAME}" chmod +x /usr/local/etc/rc.d/movienight
iocage exec "${JAIL_NAME}" sysrc movienight_enable="YES"
iocage exec "${JAIL_NAME}" sysrc movienight_enable=YES

iocage restart "${JAIL_NAME}"

Expand Down

0 comments on commit 482a52b

Please sign in to comment.