FG42/scripts/install_files.sh

95 lines
2.8 KiB
Bash
Raw Normal View History

2021-12-11 14:52:49 +00:00
#! /bin/bash
# Fg42 - Emacs Editor for advance users
#
2021-12-11 14:52:49 +00:00
# Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
#
2021-12-11 14:52:49 +00:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
2021-12-11 14:52:49 +00:00
current=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
fg42_home="$current/.."
2021-12-11 14:52:49 +00:00
# Coloring Functions
info() {
2021-12-11 14:52:49 +00:00
if [ "$1" ]
then
echo "[\033[01;32mINFO\033[00m]: $1"
2021-12-11 14:52:49 +00:00
fi
}
error() {
2021-12-11 14:52:49 +00:00
if [ "$1" ]
then
echo "[\033[01;31mERR\033[00m]: $1"
2021-12-11 14:52:49 +00:00
fi
}
warn() {
2021-12-11 14:52:49 +00:00
if [ "$1" ]
then
echo "[\033[01;33mWARN\033[00m]: $1"
2021-12-11 14:52:49 +00:00
fi
}
install_fonts() {
2021-12-11 14:52:49 +00:00
info "Downloading and installing fonts..."
mkdir -p ~/.fonts
wget "https://dl.fg42.org/fonts/0.1.0.tar.gz" -O ~/.fonts/fg42.tar.gz
tar zxf ~/.fonts/fg42.tar.gz -C ~/.fonts --strip 1
cp -r $fg42_home/share/fonts/vazir/* ~/.fonts/
info "Font installation is done."
}
install_runners() {
info "Creating the runner scripts..."
cp $current/templates/fg42 $current/../fg42
cp $current/templates/fg42-wm $current/../fg42-wm
sed -i "s'___FG42_HOME___'$fg42_home'" $fg42_home/fg42
sed -i "s'___FG42_HOME___'$fg42_home'" $fg42_home/fg42-wm
2021-12-11 14:52:49 +00:00
chmod +x $fg42_home/fg42
chmod +x $fg42_home/fg42-wm
info "Copying conifg file to ~/.fg42.el..."
cp $fg42_home/config/fg42.user.el ~/.fg42.el
2021-12-11 14:52:49 +00:00
info "Installing the runners..."
sudo mkdir -p /usr/local/bin/
sudo rm -f /usr/local/bin/fg42
sudo rm -f /usr/local/bin/fg42-wm
sudo ln -s $fg42_home/fg42 /usr/local/bin/fg42
sudo ln -s $fg42_home/fg42-wm /usr/local/bin/fg42-wm
info "Copying share files..."
sudo mkdir -p /usr/share/fg42/
sudo cp $fg42_home/share/applications/fg42.desktop /usr/local/share/applications
sudo cp -r $fg42_home/share/icons/hicolor/ /usr/local/share/icons
sudo cp -r $fg42_home/share/* /usr/share/fg42/
sudo mkdir -p /usr/share/xsessions/
2021-12-11 14:52:49 +00:00
sudo cp -r $fg42_home/share/xsessions/fg42.desktop /usr/share/xsessions/
2014-03-18 21:03:28 +00:00
}
2021-12-11 14:52:49 +00:00
install_extras() {
info "Copying share files..."
sudo mkdir -p /usr/share/fg42/
sudo cp $fg42_home/share/applications/fg42.desktop /usr/local/share/applications
sudo cp -r $fg42_home/share/icons/hicolor/ /usr/local/share/icons
sudo cp -r $fg42_home/share/* /usr/share/fg42/
sudo cp -r $fg42_home/share/xsessions/fg42.desktop /usr/share/xsessions/
}
install_$1