Skip to content

Commit

Permalink
Speed up loading time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neilpang committed Jul 18, 2022
1 parent fbc82e7 commit ce3d781
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
13 changes: 11 additions & 2 deletions conf/12.3.conf
@@ -1,3 +1,12 @@
OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v0.1.2/freebsd-12.3.ova.7z"

CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v0.1.2/conf/freebsd-12.3.conf"
BUILDER_VERSION=0.1.3


CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v${BUILDER_VERSION}/conf/freebsd-${VM_RELEASE}.conf"

OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}.ova"

VM_PUBID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-id_rsa.pub"

HOST_ID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-mac.id_rsa"

13 changes: 11 additions & 2 deletions conf/13.0.conf
@@ -1,3 +1,12 @@
OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v0.1.2/freebsd-13.0.ova.7z"

CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v0.1.2/conf/freebsd-13.0.conf"
BUILDER_VERSION=0.1.3


CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v${BUILDER_VERSION}/conf/freebsd-${VM_RELEASE}.conf"

OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}.ova"

VM_PUBID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-id_rsa.pub"

HOST_ID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-mac.id_rsa"

13 changes: 11 additions & 2 deletions conf/13.1.conf
@@ -1,3 +1,12 @@
OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v0.1.2/freebsd-13.1.ova.7z"

CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v0.1.2/conf/freebsd-13.1.conf"
BUILDER_VERSION=0.1.3


CONF_LINK="https://raw.githubusercontent.com/vmactions/freebsd-builder/v${BUILDER_VERSION}/conf/freebsd-${VM_RELEASE}.conf"

OVA_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}.ova"

VM_PUBID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-id_rsa.pub"

HOST_ID_LINK="https://github.com/vmactions/freebsd-builder/releases/download/v${BUILDER_VERSION}/freebsd-${VM_RELEASE}-mac.id_rsa"

25 changes: 15 additions & 10 deletions run.sh
Expand Up @@ -23,6 +23,8 @@ if [ -z "$VM_RELEASE" ]; then
VM_RELEASE=$DEFAULT_RELEASE
fi

export VM_RELEASE


#load the release conf
if [ ! -e "conf/$VM_RELEASE.conf" ]; then
Expand Down Expand Up @@ -65,12 +67,7 @@ osname="$VM_OS_NAME"
ostype="$VM_OS_TYPE"
sshport=$VM_SSH_PORT

ova="$VM_OVA_NAME.ova"

ovazip="$(echo "$OVA_LINK" | rev | cut -d / -f 1 | rev)"


ovafile="$ova"
ovafile="$osname-$VM_RELEASE.ova"



Expand All @@ -81,15 +78,23 @@ importVM() {

bash $vmsh setup

if [ ! -e "$ovazip" ]; then
if [ ! -e "$ovafile" ]; then
echo "Downloading $OVA_LINK"
wget -q "$OVA_LINK"
wget -O "$ovafile" -q "$OVA_LINK"
fi

if [ ! -e "$ovafile" ]; then
7za e -y $ovazip -o.
if [ ! -e "id_rsa.pub" ]; then
echo "Downloading $VM_PUBID_LINK"
wget -O "id_rsa.pub" -q "$VM_PUBID_LINK"
fi

if [ ! -e "mac.id_rsa" ]; then
echo "Downloading $VM_PUBID_LINK"
wget -O "mac.id_rsa" -q "$HOST_ID_LINK"
fi

ls -lah

bash $vmsh addSSHAuthorizedKeys id_rsa.pub
cat mac.id_rsa >$HOME/.ssh/mac.id_rsa
chmod 600 $HOME/.ssh/mac.id_rsa
Expand Down

0 comments on commit ce3d781

Please sign in to comment.