Compare commits
No commits in common. "c2cadd15427388b30d06773831728eab2ee24750" and "7ef957c2d7c9687b4e8371ae678c7a4e7e3b5042" have entirely different histories.
c2cadd1542
...
7ef957c2d7
33
update.sh
33
update.sh
@ -7,32 +7,22 @@ TAILWINDCSS_REPO_URL=https://api.github.com/repos/tailwindlabs/tailwindcss/relea
|
|||||||
TMP_DIR=/tmp
|
TMP_DIR=/tmp
|
||||||
BIN_DIR=/usr/local/bin
|
BIN_DIR=/usr/local/bin
|
||||||
|
|
||||||
check_dependency() {
|
! groups | grep -E 'root|wheel|sudo' >/dev/null && echo "You need administrative privileges for this script" && exit 1
|
||||||
if ! which $1 >/dev/null 2>&1; then
|
|
||||||
echo "$1 needs to be installed" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! groups | grep -E 'root|wheel|sudo' >/dev/null; then
|
! which curl >/dev/null 2>&1 && echo "curl needs to be installed" >&2 && exit 1
|
||||||
echo "You need administrative privileges for this script" >&2
|
! which go >/dev/null 2>&1 && echo "go needs to be installed" >&2 && exit 1
|
||||||
exit 1
|
! which jq >/dev/null 2>&1 && echo "jq needs to be installed" >&2 && exit 1
|
||||||
fi
|
! which tar >/dev/null 2>&1 && echo "tar needs to be installed" >&2 && exit 1
|
||||||
|
! which xargs >/dev/null 2>&1 && echo "xargs needs to be installed" >&2 && exit 1
|
||||||
|
|
||||||
check_dependency curl
|
echo -e '\nDownloading cpolis...'
|
||||||
check_dependency go
|
|
||||||
check_dependency jq
|
|
||||||
check_dependency tar
|
|
||||||
check_dependency xargs
|
|
||||||
|
|
||||||
echo -e '\nDownloading cpolis...' >&2
|
|
||||||
rm -fr $CPOLIS_DIR/*
|
rm -fr $CPOLIS_DIR/*
|
||||||
latest_release=$(curl -s $CPOLIS_REPO_URL | jq -r '.[0].tag_name')
|
latest_release=$(curl -s $CPOLIS_REPO_URL | jq -r '.[0].tag_name')
|
||||||
curl -Lo $TMP_DIR/cpolis.tar.gz https://git.streifling.com/jason/cpolis/archive/$latest_release.tar.gz
|
curl -Lo $TMP_DIR/cpolis.tar.gz https://git.streifling.com/jason/cpolis/archive/$latest_release.tar.gz
|
||||||
tar -xzf $TMP_DIR/cpolis.tar.gz -C $EXTRACTION_DIR
|
tar -xzf $TMP_DIR/cpolis.tar.gz -C $EXTRACTION_DIR
|
||||||
rm $TMP_DIR/cpolis.tar.gz
|
rm $TMP_DIR/cpolis.tar.gz
|
||||||
|
|
||||||
echo -e '\nDownloading TailwindCSS...' >&2
|
echo -e '\nDownloading TailwindCSS...'
|
||||||
curl -s $TAILWINDCSS_REPO_URL |
|
curl -s $TAILWINDCSS_REPO_URL |
|
||||||
grep -F browser_download_url |
|
grep -F browser_download_url |
|
||||||
grep -F linux-x64 |
|
grep -F linux-x64 |
|
||||||
@ -41,15 +31,12 @@ curl -s $TAILWINDCSS_REPO_URL |
|
|||||||
chmod +x $CPOLIS_DIR/tailwindcss
|
chmod +x $CPOLIS_DIR/tailwindcss
|
||||||
$CPOLIS_DIR/tailwindcss -i web/static/css/input.css -o web/static/css/style.css
|
$CPOLIS_DIR/tailwindcss -i web/static/css/input.css -o web/static/css/style.css
|
||||||
|
|
||||||
echo -e 'Building cpolis...' >&2
|
|
||||||
go build -o $TMP_DIR/cpolis $CPOLIS_DIR/cmd/main.go
|
go build -o $TMP_DIR/cpolis $CPOLIS_DIR/cmd/main.go
|
||||||
|
|
||||||
echo -e 'Setting system files up...' >&2
|
echo -e 'Setting system files up'
|
||||||
sudo mv $TMP_DIR/cpolis $BIN_DIR/cpolis
|
sudo mv $TMP_DIR/cpolis $BIN_DIR/cpolis
|
||||||
sudo chown root:root $BIN_DIR/cpolis
|
|
||||||
chmod +x $BIN_DIR/cpolis
|
chmod +x $BIN_DIR/cpolis
|
||||||
|
|
||||||
sudo mv $CPOLIS_DIR/cpolis.service $SYSTEMD_DIR
|
sudo mv $CPOLIS_DIR/cpolis.service /etc/systemd/system
|
||||||
sudo chown root:root $SYSTEMD_DIR/cpolis.service
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl is-active --quiet cpolis.service && sudo systemctl restart cpolis.service
|
sudo systemctl is-active --quiet cpolis.service && sudo systemctl restart cpolis.service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user