#!/bin/bash

#############################################
### MARK: First Wrote at - 2023-07-30 09:20:00 UTC+09:00:00 (KST)
### MARK: 2nd Updated at - 2023-08-09 08:03:00 UTC+09:00:00 (KST)
### MARK: Lastest Updated at - 2023-08-09 08:28:00 UTC+09:00:00 (KST)
###        → Added go install script.
### Writer : Cellularhacker - https://github.com/Cellularhacker

sudo apt install -y \
	zlib1g zlib1g-dev unzip zip wget\
	ffmpeg \
	python3-certifi \
	brotli python3-brotli \
	python3-websockets python3-websockify python3-wsproto \
	python3-mutagen python-mutagen-doc python3-mediafile xattr python3-xattr \
	python3-cryptography python3-cryptography-vectors python-cryptography-doc python3-jeepney jeepney-doc python3-selenium 


# MARK: install pycryptodome
pip install pycryptodome


# MARK: download go for linux
GO_OS='linux'
GO_ARCHITECTURE='amd64'
GO_VERSION='1.21.0'
ARCHIVE_EXT='tar.gz'
ARCHIVE_BASE_URI='https://go.dev/dl'
GO_ARCHIVE_NAME="go${GO_VERSION}.${GO_OS}-${GO_ARCHITECTURE}.${ARCHIVE_EXT}"
GO_ARCHIVE_URI="${ARCHIVE_BASE_URI}/${GO_ARCHIVE_NAME}"
GO_INSTALL_PATH='/usr/local'

wget "${GO_ARCHIVE_URI}"

tar -C  "${GO_INSTALL_PATH}" -zxvf "${GO_ARCHIVE_NAME}"

sudo $(echo 'export GOROOT=/usr/local/go' >> /etc/profile)
sudo $(echo 'export PATH=$PATH:${GOROOT}/bin' >> /etc/profile)


echo 'if ` $ go version` command is not working, please try to add following 2 lines add on your Local shell config file.'
echo 'Ex) ~/.bashrc, ~/.zshrc'
echo ''
echo `export GOROOT=/usr/local/go`
echo `export PATH=\$PATH:\${GOROOT}/bin`


# MARK: Install ytarchive by using 'go install' cmd
/usr/local/go/bin/go install github.com/Kethsar/ytarchive@master


#mkdir t_ytdlp ; cd t_ytdlp
#wget 'https://github.com/wez/atomicparsley/releases/download/20221229.172126.d813aa6/AtomicParsleyLinux.zip'

