Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux install script #257

Merged
merged 1 commit into from
Dec 3, 2024
Merged
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
25 changes: 25 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Installing PyFDA
To install PyFDA using the install script, simply make the file "install.sh" executable and execute it:

```
$> chmod +x ./install.sh
$> ./install.sh
```

The script will install PyFDA to the directory specified by the $INSTALL_DIR variable, which defaults to $HOME/.pyfda.

It will also create a .desktop file in the location specified by $DESKTOP_FILE.

If you wish to change these paths, simply edit the variables in the script.

# Removing PyFDA
You can remove PyFDA by symply running the file "uninstall.sh".

MAKE SURE THAT THE DIRECTORY SPECIFIED IN THE SCRIPT IS CORRECT!

```
$> chmod +x ./uninstall.sh
$> ./uninstall.sh
```

The script will delete the directory specified by the $INSTALL_DIR variable, which defaults to $HOME/.pyfda.
Binary file added installer/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions installer/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
INSTALL_DIR=$HOME/.pyfda
DESKTOP_FILE=$HOME/.local/share/applications/pyfda.desktop

# Check if python3 is installed
if ! command -v python3 > /dev/null ; then
echo "Error: Python 3 is not in PATH!";
exit 1;
fi

# Create install directory, exit on fail
if [ ! -d "$INSTALL_DIR" ]; then
mkdir $INSTALL_DIR || exit 1;
fi

python3 -m venv $INSTALL_DIR/venv
source $INSTALL_DIR/venv/bin/activate
python3 -m pip install pyfda
deactivate

# Create Desktop file
cp ./icon.png $INSTALL_DIR
echo "[Desktop Entry]" > $INSTALL_DIR/pyfda.desktop
echo "Name=PyFDA" >> $INSTALL_DIR/pyfda.desktop
echo "Comment=PyFDA Filter Design Tool" >> $INSTALL_DIR/pyfda.desktop
echo "Exec=/bin/bash -c 'source $INSTALL_DIR/venv/bin/activate && $INSTALL_DIR/venv/bin/python $INSTALL_DIR/venv/bin/pyfdax'" >> $INSTALL_DIR/pyfda.desktop
echo "Icon=$INSTALL_DIR/icon.png" >> $INSTALL_DIR/pyfda.desktop
echo "Terminal=false" >> $INSTALL_DIR/pyfda.desktop
echo "Type=Application" >> $INSTALL_DIR/pyfda.desktop

ln $INSTALL_DIR/pyfda.desktop $DESKTOP_FILE
19 changes: 19 additions & 0 deletions installer/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
INSTALL_DIR=$HOME/.pyfda
DESKTOP_FILE=$HOME/.local/share/applications/pyfda.desktop

echo "This script will uninstall pyfda and all files that belong to it."
echo "The following files and directories will be deleted:"
echo "$INSTALL_DIR"
echo "$DESKTOP_FILE"

echo
read -p "Are you sure you want to do this? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -r $INSTALL_DIR
rm $DESKTOP_FILE
else
echo "Aborted."
fi
Loading