-
-
Save Brandonshire/73098f982d00d13ddf93a8d484160da2 to your computer and use it in GitHub Desktop.
Install Fish Shell 3+ on Raspberry Pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a quick installer | |
# script I made to build and install the latest version of | |
# fish on my Raspberry Pi. | |
# | |
# Use at your own risk as I have made no effort to make | |
# this install safe! | |
set -e | |
FISH_VERSION="3.3.1" | |
# Install dependencies | |
sudo apt-get install build-essential cmake ncurses-dev libncurses5-dev libpcre2-dev gettext | |
# Create a build directory | |
mkdir fish-install | |
cd fish-install | |
# Download and extract the latest build (could clone from git but that's less stable) | |
wget https://github.com/fish-shell/fish-shell/releases/download/$FISH_VERSION/fish-$FISH_VERSION.tar.xz | |
tar -xvf fish-$FISH_VERSION.tar.xz | |
cd fish-$FISH_VERSION | |
# Build and install | |
cmake . | |
make | |
sudo make install | |
# Add to shells | |
echo /usr/local/bin/fish | sudo tee -a /etc/shells | |
# Set as user's shell | |
chsh -s /usr/local/bin/fish | |
# Delete build directory | |
cd ../../ | |
rm -rf fish-install |
I get this error
Do you want to continue? [Y/n] Y debconf: unable to initialize frontend: Dialog debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.) debconf: falling back to frontend: Readline Selecting previously unselected package cmake-data. dpkg: unrecoverable fatal error, aborting: files list file for package 'libraspberrypi-dev' contains empty filename E: Sub-process /usr/bin/dpkg returned an error code (2)
@ali80
You could try to use dpkg to remove the corrupted package:
sudo dpkg --purge libraspberrypi-dev
Then clean:
sudo apt-get clean
And remove old packages:
sudo apt-get autoremove
Then:
sudo apt-get update
sudo apt-get -f upgrade
Finally:
sudo apt-get -f install
Or:
sudo apt-get install libraspberrypi-dev
Report back any additional errors along the way..
Note that the script above downloads version 3.3.1 explicitly, not the latest version - use the script below for version and error checking.
#!/usr/bin/env bash
err() { rm -rf "$TMP"; echo "$1"; exit 1; }
retry() { echo "$1 failed, temporary files at $TMP, please retry manually"; }
echo 'Creating temporary directory...'
TMP=$(mktemp -d || { echo 'Was not allowed to create a temporary directory'; exit 1; })
cd "$TMP" || err 'Could not switch to the temporary directory'
echo 'Checking the newest version number...'
REQ=$(curl -s https://api.github.com/repos/fish-shell/fish-shell/releases/latest || err 'Did not get network response')
if [[ $REQ =~ 'rate limit' ]]; then
err 'You are currently rate limited on github, please wait 60 min before retrying'
fi
URL=$(echo "$REQ" | sed -rne 's/.*browser_download_url": "(.*\.xz)"/\1/p' || err 'Somehow failed to get download URL')
VERSION=$(echo "$URL" | sed -rne 's/.*download\/(.*)\/.*/\1/p' || err 'Somehow failed to get version number')
echo "Downloading version $VERSION..."
wget -qO fish.tar.xz "$URL" || err 'Could not download archive'
echo 'Extracting archive...'
tar -xf fish.tar.xz || err 'Could not extract archive'
cd "fish-$VERSION" || err 'Could not switch to the extracted directory'
echo 'Building, this may take a while...'
cmake . || retry '"cmake ."'
make || retry '"make"'
echo 'Installing...'
sudo make install || retry '"sudo make install"'
sleep 3
rm -rf "$TMP"
echo "Installed, make sure to add fish ($(which fish)) to /etc/shells"
@Aonodensetsu Thank you! That is much improved, and beyond my abilities, when I started working on this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmmm... sadly I'm not sure I can help with that. I have no idea what the problem is!