Skip to content

Commit

Permalink
Add support for ArchLinux
Browse files Browse the repository at this point in the history
- Added support for ArchLinux
  • Loading branch information
tmiland committed Feb 12, 2020
1 parent 447dde7 commit 4a4d23a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 17 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
| ------ | ------ |
| [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/CentOS.png" height="140" width="280">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/CentOS.png) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/Fedora.png" height="140" width="280">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/Fedora.png)

| Arch |
| ------ |
| [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/Arch.png" height="140" width="280">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/Arch.png)

## Recommendation

***It is recommended to use this script on a fresh installation to avoid unwanted complications.***
Expand Down Expand Up @@ -135,9 +139,9 @@ sudo passwd root
Tested and working on:
| Debian | Ubuntu | CentOS | Fedora |
| ------ | ------ | ------ | ------ |
| [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/debian.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/debian.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/ubuntu.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/ubuntu.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/cent-os.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/cent-os.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/fedora.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/fedora.svg?sanitize=true)
| Debian | Ubuntu | CentOS | Fedora | Arch |
| ------ | ------ | ------ | ------ | ------ |
| [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/debian.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/debian.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/ubuntu.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/ubuntu.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/cent-os.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/cent-os.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/fedora.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/fedora.svg?sanitize=true) | [<img src="https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/arch.svg?sanitize=true" height="128" width="128">](https://raw.githubusercontent.com/tmiland/Invidious-Updater/master/img/os_icons/arch.svg?sanitize=true)
- [X] Tested extensively on Debian 9/10
- [X] Docker option tested and working
Expand All @@ -154,6 +158,7 @@ Tested and working on:
- [X] Docker option not working
- [X] Tested on Linux Mint.
- See [#15](https://github.com/tmiland/Invidious-Updater/issues/15)
- [X] Tested on Arch Linux
If you get permission issues, set selinux to permissive.
See how to here: [Disable SELinux or Set it to Permissive mode in Fedora 28 / 29, RHEL or CentOS](https://www.kaizenuslife.com/disable-or-set-selinux-permissive-in-fedora-rhel-or-cent-os/)
Expand Down Expand Up @@ -189,6 +194,8 @@ Ideas:
* Fedora 29
* Docker support
- [OS requirements](https://docs.docker.com/install/linux/docker-ce/fedora/)
* Arch Linux
- Docker option not tested yet.
## Credits
- Code is mixed and and customized from these sources:
Expand Down
47 changes: 33 additions & 14 deletions invidious_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#### Maintained by @tmiland ####
######################################################################

version='1.4.5' # Must stay on line 14 for updater to fetch the numbers
version='1.4.6' # Must stay on line 14 for updater to fetch the numbers

#------------------------------------------------------------------------------#
#
Expand Down Expand Up @@ -117,29 +117,35 @@ if ! lsb_release -si >/dev/null 2>&1; then
DISTRO=$(cat /etc/issue.net)
elif [[ -f /etc/redhat-release ]]; then
DISTRO=$(cat /etc/redhat-release)
elif [[ -f /etc/os-release ]]; then
DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}')
fi

case "$DISTRO" in
Debian*)
PKGCMD="apt-get"
PKGCMD="apt-get -o Dpkg::Progress-Fancy="1" install -qq"
LSB=lsb-release
;;
Ubuntu*)
PKGCMD="apt"
PKGCMD="apt-get -o Dpkg::Progress-Fancy="1" install -qq"
LSB=lsb-release
;;
LinuxMint*)
PKGCMD="apt"
PKGCMD="apt-get -o Dpkg::Progress-Fancy="1" install -qq"
LSB=lsb-release
;;
CentOS*)
PKGCMD="yum"
PKGCMD="yum install -y"
LSB=redhat-lsb
;;
Fedora*)
PKGCMD="dnf"
PKGCMD="dnf install -y"
LSB=redhat-lsb
;;
Arch*)
PKGCMD="yes | LC_ALL=en_US.UTF-8 pacman -S"
LSB=lsb-release
;;
*) echo -e "${RED}${ERROR} unknown distro: '$DISTRO'${NC}" ; exit 1 ;;
esac

Expand All @@ -152,13 +158,7 @@ if ! lsb_release -si >/dev/null 2>&1; then
case $answer in
[Yy]* )
echo -e "${GREEN}${ARROW} Installing ${LSB} on ${DISTRO}...${NC}"
# Make sure that the script runs with root permissions
if [[ "$EUID" != 0 ]]; then
echo -e "${RED}${ERROR} This action needs root permissions.${NC} Please enter your root password...";
su -s "$(which bash)" -c "${PKGCMD} install -y ${LSB}"
else
echo -e "${RED}${ERROR} Error: could not install ${LSB}!${NC}"
fi
su -s "$(which bash)" -c "${PKGCMD} ${LSB}" || echo -e "${RED}${ERROR} Error: could not install ${LSB}!${NC}"
echo -e "${GREEN}${DONE} Done${NC}"
sleep 3
cd ${CURRDIR}
Expand Down Expand Up @@ -228,6 +228,22 @@ elif [[ $(lsb_release -si) == "Fedora" ]]; then
UNINSTALL_PKGS="crystal openssl-devel libxml2-devel libyaml-devel gmp-devel readline-devel librsvg2-tools sqlite-devel"
# PostgreSQL Service
PGSQL_SERVICE="postgresql-11.service"
elif [[ $(lsb_release -si) == "Arch" ]]; then
SUDO="sudo"
UPDATE="pacman -Syu"
INSTALL="pacman -S --noconfirm --needed"
UNINSTALL="pacman -R"
PURGE="pacman -Rs"
CLEAN="pacman -Sc"
PKGCHK="pacman -Qs"
# Pre-install packages
PRE_INSTALL_PKGS="git curl sudo"
# Install packages
INSTALL_PKGS="base-devel shards crystal librsvg postgresql"
#Uninstall packages
UNINSTALL_PKGS="base-devel shards crystal librsvg"
# PostgreSQL Service
PGSQL_SERVICE="postgresql.service"
else
echo -e "${RED}${ERROR} Error: Sorry, your OS is not supported.${NC}"
exit 1;
Expand Down Expand Up @@ -857,7 +873,7 @@ get_crystal() {
elif [[ $(lsb_release -si) == "Darwin" ]]; then
exit 1;
elif [[ $(lsb_release -si) == "Arch" ]]; then
exit 1;
echo "Arch Linux... Skipping manual crystal install"
else
echo -e "${RED}${ERROR} Error: Sorry, your OS is not supported.${NC}"
exit 1;
Expand Down Expand Up @@ -1130,6 +1146,9 @@ host replication all ::1/128 md5" | ${SUDO} t
${SUDO} chmod 600 /var/lib/pgsql/11/data/pg_hba.conf
fi
fi
if [[ $(lsb_release -si) == "Arch" ]]; then
su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
fi
${SUDO} systemctl enable ${PGSQL_SERVICE}
sleep 1
${SUDO} systemctl restart ${PGSQL_SERVICE}
Expand Down

0 comments on commit 4a4d23a

Please sign in to comment.