Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjusting missleading output and removal of spaces #50

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions unifi_ssl_import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ printf "\nStopping UniFi Controller...\n"
service "${UNIFI_SERVICE}" stop

if [[ ${LE_MODE} == "true" ]]; then
# Write a new MD5 checksum based on the updated certificate

# Write a new MD5 checksum based on the updated certificate
printf "\nUpdating certificate MD5 checksum...\n"

md5sum "${PRIV_KEY}" > "${LE_LIVE_DIR}/${UNIFI_HOSTNAME}/privkey.pem.md5"

fi

# Create double-safe keystore backup
Expand All @@ -120,7 +120,7 @@ else
printf "\nNo original keystore backup found.\n"
printf "\nCreating backup as keystore.orig...\n"
fi

# Export your existing SSL key, cert, and CA data to a PKCS12 file
printf "\nExporting SSL certificate and key data into temporary PKCS12 file...\n"

Expand All @@ -139,11 +139,11 @@ else
-out "${P12_TEMP}" -passout pass:"${PASSWORD}" \
-name "${ALIAS}"
fi

# Delete the previous certificate data from keystore to avoid "already exists" message
printf "\nRemoving previous certificate data from UniFi keystore...\n"
keytool -delete -alias "${ALIAS}" -keystore "${KEYSTORE}" -deststorepass "${PASSWORD}"

# Import the temp PKCS12 file into the UniFi keystore
printf "\nImporting SSL certificate into UniFi keystore...\n"
keytool -importkeystore \
Expand All @@ -157,9 +157,9 @@ keytool -importkeystore \
# Clean up temp files
printf "\nRemoving temporary files...\n"
rm -f "${P12_TEMP}"

# Restart the UniFi Controller to pick up the updated keystore
printf "\nRestarting UniFi Controller to apply new Let's Encrypt SSL certificate...\n"
printf "\nRestarting UniFi Controller to apply new SSL certificate...\n"
service "${UNIFI_SERVICE}" start

# That's all, folks!
Expand Down
2 changes: 1 addition & 1 deletion upgrade_unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# USAGE
# Update the user-configurable settings below, then run ./upgrade_unifi.sh from
# the command line.
#
#
# Devices will be upgraded in the order their IP addresses appear in the their
# *_ip_list array. Take that into consideration when adding IPs to each array.
#################################################################################
Expand Down
24 changes: 12 additions & 12 deletions upgrade_unifi_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# Last Updated January 8, 2017

# REQUIREMENTS
# 1) Assumes you already have any version of UniFi Controller installed
# 1) Assumes you already have any version of UniFi Controller installed
# and running on your system.
# 2) Assumes a user named "ubnt" owns the /opt/UniFi directory.
# 3) Requires a service start/stop script to properly shut down and
# 3) Requires a service start/stop script to properly shut down and
# restart the UniFi controller before and after upgrade. I've written
# compatible startup scrips for SysV and systemd systems at
# compatible startup scrips for SysV and systemd systems at
# http://wp.me/p1iGgP-2wl
# 4) Requires wget command to fetch the software from UBNT's download site.

Expand Down Expand Up @@ -61,42 +61,42 @@ if [ -f "$UNIFI_ARCHIVE_FILENAME" ]; then
# Stop the local UniFi Controller service
printf "\n"
service $UNIFI_SERVICE stop

# Remove previous backup directory (if it exists)
if [ -d "$UNIFI_BACKUP_DIR" ]; then
printf "\nRemoving previous backup directory...\n"
rm -rf $UNIFI_BACKUP_DIR
fi

# Move existing UniFi directory to backup location
printf "\nMoving existing UniFi Controller directory to backup location...\n"
mv $UNIFI_DIR $UNIFI_BACKUP_DIR

# Extract new version
printf "\nExtracting downloaded software..."
unzip -qq $TEMP_DIR/$UNIFI_ARCHIVE_FILENAME -d $UNIFI_PARENT_DIR &
show_dots $!

# Jump into the backup directory
cd $UNIFI_BACKUP_DIR || exit

# Create an archive of the existing data directory
printf "\nBacking up existing UniFi Controller data..."
tar zcf $TEMP_DIR/unifi_data_bak.tar.gz data/ &
show_dots $!

# Extract the data into the new directory
printf "\nExtracting UniFi Controller backup data to new directory..."
tar zxf $TEMP_DIR/unifi_data_bak.tar.gz -C $UNIFI_DIR &
show_dots $!

# Enforce proper ownership of UniFi directory
chown -R $UNIFI_OWNER:$UNIFI_OWNER $UNIFI_DIR

# Restart the local UniFi Controller service
printf "\n"
service $UNIFI_SERVICE start

# All done!
printf "\nUpgrade of UniFi Controller complete!\n"

Expand Down