Skip to content
Open
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
132 changes: 85 additions & 47 deletions installStremioFedora.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
# Stremio Installer for Fedora 30
# Stremio Installer for Fedora
clear
spec_file="$PWD/stremio.spec"
work_dir="$PWD/work"
rpm_dir="$PWD/RPMS"
download_dir="$PWD/stremio-shell"
build_deps="nodejs wget librsvg2-devel librsvg2-tools mpv-libs-devel qt5-qtbase-devel qt5-qtwebengine-devel qt5-qtquickcontrols qt5-qtquickcontrols2 openssl-devel gcc make glibc-devel kernel-headers binutils rpmdevtools"

# Installing dependencies
dep_install() {
dep_check_and_install() {
echo -e "\e[93m\e[40m------------------\e[0m"
echo -e "\e[93m\e[40mInstalling Dependecies\e[0m"
echo -e "\e[93m\e[40mChecking Dependecies\e[0m"
echo -e "\e[93m\e[40m------------------\e[0m"
sleep 1s
sudo dnf install nodejs wget librsvg2-devel librsvg2-tools mpv-libs-devel qt5-qtbase-devel qt5-qtwebengine-devel qt5-qtquickcontrols qt5-qtquickcontrols2 openssl-devel gcc g++ make glibc-devel kernel-headers binutils -y
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mWe could not install all dependencies. Please try again!\e[0m"
read -n 1 -s -r -p "Press any key to continue"
exit 1;

for package in $build_deps
do
if ! rpm -q $package > /dev/null ; then #checks if package exists and if not add it to missing_deps
missing_deps+=($package)
fi
done

if [[ ${#missing_deps[@]} > 0 ]]; #checks if missing packages are found
then
echo "${missing_deps[@]} missing"
sudo dnf install ${missing_deps[@]}
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mWe could not install all dependencies. Please try again!\e[0m"
read -e -n 1 -s -r -p "Press any key to continue"
exit 1;
fi
else
echo "Dependencies are satisfied"
fi
}

Expand All @@ -23,55 +41,75 @@ main_download() {
git clone --recurse-submodules https://github.com/Stremio/stremio-shell.git
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mWe could not download Stremio. Check your internet connection and try again!\e[0m"
read -n 1 -s -r -p "Press any key to continue"
read -e -n 1 -s -r -p "Press any key to continue"
exit 1;
fi
}

# Patching release file so it uses qmake-qt5 because qmake is not recognized in fedora
patching() {
echo -e "\e[93m\e[40m--------------\e[0m"
echo -e "\e[93m\e[40mPatching files\e[0m"
echo -e "\e[93m\e[40m--------------\e[0m"
sed -i 's/qmake/qmake-qt5/g' release.makefile
}
#Making directories for building phase
make_directories(){
if [ ! -d "$work_dir" ]; then
mkdir -p $work_dir
fi

# Compiling and installing Stremio
compile_install() {
echo -e "\e[93m\e[40m--------------------------------\e[0m"
echo -e "\e[93m\e[40mCompiling and installing Stremio\e[0m"
echo -e "\e[93m\e[40m--------------------------------\e[0m"
qmake-qt5
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mCan't set the project up. QMAKE error !\e[0m"
read -n 1 -s -r -p "Press any key to continue"
exit 1;
if [ ! -d "$rpm_dir" ]; then
mkdir -p $rpm_dir
fi
make -f release.makefile
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mCan't compile project. MAKE error !\e[0m"
read -n 1 -s -r -p "Press any key to continue"
exit 1;

if [ -d "$PWD/stremio-shell" ]; then
rm -rf stremio-shell
fi
sudo make -f release.makefile install
if [ $? -ne 0 ]; then
echo -e "\e[91m\e[40mCan't install the project. MAKE error !\e[0m"
read -n 1 -s -r -p "Press any key to continue"
exit 1;
}

#Checks if rpms already exist
check_rpms_folder(){
if [ "$(ls -A $rpm_dir/x86_64/)" ]; then
rpms="$(ls $rpm_dir/x86_64/Stremio-$1-* 2>/dev/null)"
if [ $? -eq 0 ]; then
while true; do
read -p "RPM of the same version is found. Do you wish to install it? [Y/N]" yn
case $yn in
[Yy]* ) install_rpm $1; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
else
rm $rpm_dir/x86_64/*
fi
fi
sudo ./dist-utils/common/postinstall
}

dep_install
#Building the rpm package
generate_rpm(){
pkg_version=$(git rev-parse --short HEAD)
check_rpms_folder $pkg_version
rpmbuild -bb "$spec_file" --define "_topdir $work_dir" --define "downloaded_dir $download_dir" --define "_rpmdir $rpm_dir" --define "pkg_version $pkg_version"
install_rpm $pkg_version
}

#Installing the built package
install_rpm(){
sudo dnf install $rpm_dir/x86_64/Stremio-$1-*
exit_script
}

#Clean up
exit_script(){
cd ..
rm -rf stremio-shell

echo "DONE!"
read -e -n 1 -s -r -p "Press any key to continue"
exit 0
}

make_directories
dep_check_and_install
main_download
cd stremio-shell
patching
compile_install
generate_rpm



# Cleaning up
cd ..
rm -rf stremio-shell

echo "DONE!"
read -n 1 -s -r -p "Press any key to continue"
exit 0
83 changes: 83 additions & 0 deletions stremio.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

Name: Stremio
Version: %{pkg_version}
Release: 1%{?dist}
Summary: Streaming shows and movies

License: GPLv3
URL: https://github.com/Stremio/stremio-shell
Source0: https://github.com/Stremio/stremio-shell

BuildRequires: nodejs
BuildRequires: wget
BuildRequires: librsvg2-devel
BuildRequires: librsvg2-tools
BuildRequires: mpv-libs-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtwebengine-devel
BuildRequires: qt5-qtquickcontrols
BuildRequires: qt5-qtquickcontrols2
BuildRequires: openssl-devel
BuildRequires: gcc
BuildRequires: g++
BuildRequires: make
BuildRequires: glibc-devel
BuildRequires: kernel-headers
BuildRequires: binutils


Requires: qt5-qtbase-devel%{?_isa}

%description
The Next Generation Media Center

%prep



%build
cd %{downloaded_dir}
%{qmake_qt5}
make -f release.makefile


%install
rm -rf $RPM_BUILD_ROOT
cd %{downloaded_dir}

PREFIX=%{buildroot} make -f release.makefile install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/usr/share/applications
mkdir -p %{buildroot}/usr/bin
touch %{buildroot}/usr/share/applications/smartcode-stremio.desktop
touch %{buildroot}/usr/bin/stremio



%files
/opt/*
%ghost /usr/share/applications/smartcode-stremio.desktop
%ghost /usr/bin/stremio
%ghost /usr/local/share/applications/smartcode-stremio.desktop

%post

ln -sf /opt/stremio/smartcode-stremio.desktop /usr/share/applications/smartcode-stremio.desktop
ln -sf /opt/stremio/stremio /usr/bin/stremio

xdg-desktop-menu install --mode system /opt/stremio/smartcode-stremio.desktop

cd /opt/stremio/icons || exit 1
regex="([^_]+)_([0-9]+).png$"
for file in *.png
do
if [[ $file =~ $regex ]]
then
icon="${BASH_REMATCH[1]##*/}"
size="${BASH_REMATCH[2]}"
xdg-icon-resource install --context apps --size "$size" "$file" "$icon"
fi
done

%changelog
* Sun Jan 30 2022 lolsniperftw
- .spec file for Stremio