fish: add package fish shell

Signed-off-by: Curtis Jiang <jqqqqqqqqqq@qq.com>
This commit is contained in:
Curtis Jiang 2018-08-31 21:55:22 -04:00
parent 1ddb7746bb
commit 64920f50c0
2 changed files with 121 additions and 0 deletions

67
utils/fish/Makefile Normal file
View File

@ -0,0 +1,67 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fish
PKG_VERSION:=2.7.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/fish-shell/fish-shell/tar.gz/$(PKG_VERSION)?
PKG_HASH:=eb43ea2eb9accf76661c487dd530a5fd345fa40a3201bd22cef2c52be39fb474
PKG_MAINTAINER:=Curtis Jiang <jqqqqqqqqqq@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/fish-shell-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/fish
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Shells
TITLE:=A smart and user-friendly command line shell
DEPENDS:=+libncurses +libstdcpp +librt
URL:=https://fishshell.com
endef
define Package/fish/description
Fish is a smart and user-friendly command line shell for OS X, Linux, and the
rest of the family. Fish includes features like syntax highlighting,
autosuggest-as-you-type, and fancy tab completions that just work, with no
configuration required.
endef
CONFIGURE_VARS += ac_cv_file__proc_self_stat=yes
TARGET_CXXFLAGS += -std=c++0x
define Package/fish/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/fish $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/share/fish
$(CP) $(PKG_INSTALL_DIR)/usr/share/fish/* $(1)/usr/share/fish/
rm -rf $(1)/usr/share/fish/groff
rm -rf $(1)/usr/share/fish/man
rm -rf $(1)/usr/share/fish/tools
endef
define Package/fish/postinst
#!/bin/sh
grep fish $${IPKG_INSTROOT}/etc/shells || \
echo "/usr/bin/fish" >> $${IPKG_INSTROOT}/etc/shells
# Backwards compatibility
if [[ -e /bin/fish ]] && ([[ ! -L /bin/fish ]] || [[ "$(readlink -fn $${IPKG_INSTROOT}/bin/fish)" != "../$(CONFIGURE_PREFIX)/bin/fish" ]]); then
ln -fs "../$(CONFIGURE_PREFIX)/bin/fish" "$${IPKG_INSTROOT}/bin/fish"
fi
endef
define Package/fish/postrm
rm -rf "$${IPKG_INSTROOT}/$(CONFIGURE_PREFIX)/share/fish/$(PKG_VERSION)"
endef
$(eval $(call BuildPackage,fish))

View File

@ -0,0 +1,54 @@
diff --git a/share/functions/prompt_hostname.fish b/share/functions/prompt_hostname.fish
index 4348bce2..8502ce3f 100644
--- a/share/functions/prompt_hostname.fish
+++ b/share/functions/prompt_hostname.fish
@@ -2,7 +2,7 @@
# hostname command uses. So cache the answer so including it in the prompt doesn't make fish seem
# slow.
if not set -q __fish_prompt_hostname
- set -g __fish_prompt_hostname (hostname | string split '.')[1]
+ set -g __fish_prompt_hostname (uname -n | string split '.')[1]
end
function prompt_hostname
diff --git a/share/tools/web_config/sample_prompts/pythonista.fish b/share/tools/web_config/sample_prompts/pythonista.fish
index 9529035c..57ffaf86 100644
--- a/share/tools/web_config/sample_prompts/pythonista.fish
+++ b/share/tools/web_config/sample_prompts/pythonista.fish
@@ -7,7 +7,7 @@ function fish_prompt
set -g VIRTUAL_ENV_DISABLE_PROMPT true
end
set_color yellow
- printf '%s' (whoami)
+ printf '%s' (id -un)
set_color normal
printf ' at '
diff --git a/share/tools/web_config/sample_prompts/screen_savvy.fish b/share/tools/web_config/sample_prompts/screen_savvy.fish
index 411a5501..5cdcfb69 100644
--- a/share/tools/web_config/sample_prompts/screen_savvy.fish
+++ b/share/tools/web_config/sample_prompts/screen_savvy.fish
@@ -2,8 +2,8 @@
# author: Matthias
function fish_prompt -d "Write out the prompt"
if test -z $WINDOW
- printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
+ printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (id -un) (set_color purple) (prompt_hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
else
- printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (prompt_hostname) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
+ printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (id -un) (set_color purple) (prompt_hostname) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
end
end
diff --git a/share/tools/web_config/sample_prompts/terlar.fish b/share/tools/web_config/sample_prompts/terlar.fish
index d49ef340..59b3d267 100644
--- a/share/tools/web_config/sample_prompts/terlar.fish
+++ b/share/tools/web_config/sample_prompts/terlar.fish
@@ -6,7 +6,7 @@ function fish_prompt --description 'Write out the prompt'
# User
set_color $fish_color_user
- echo -n (whoami)
+ echo -n (id -un)
set_color normal
echo -n '@'