#!/usr/bin/env bash

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

# Script for restoring original Paper lantern users StatsBar

BASE_UPD_URL='http://httpupdate.cpanel.net/cpanelsync/'
CPANEL_VER=$(/bin/cat /usr/local/cpanel/version)
CPANEL_BASE=/usr/local/cpanel
PAPER_LANTERN_DIR="${CPANEL_BASE}/base/frontend/paper_lantern/home"

if [[ -d ${PAPER_LANTERN_DIR} ]]; then
    cd ${PAPER_LANTERN_DIR} || exit

    echo "${BASE_UPD_URL}${CPANEL_VER}/paper_lantern/home/retro/stats_bar.html.tt => ${PAPER_LANTERN_DIR}/retro/stats_bar.html.tt"
    /usr/bin/wget --quiet "${BASE_UPD_URL}${CPANEL_VER}/paper_lantern/home/retro/stats_bar.html.tt.xz" -O retro/stats_bar.html.tt.xz
    /usr/bin/unxz --force --decompress retro/stats_bar.html.tt.xz
fi
