Skip to content

Commit

Permalink
Additional Distro Support (#128)
Browse files Browse the repository at this point in the history
  * Closes #125 
  * Closes #126 
  * Closes #129 
  * Closes #130 

Signed-off-by: Mike Detwiler <[email protected]>
  • Loading branch information
detwiler authored Sep 11, 2022
1 parent b448e88 commit 0b053eb
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 62 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
- image: alpine:latest
- image: quay.io/centos/centos:stream8
- image: quay.io/centos/centos:stream9
- image: debian:latest
- image: fedora:latest
- image: registry.access.redhat.com/ubi9/ubi
- image: ubuntu:20.04
- image: ubuntu:latest
- image: ubuntu:rolling
Expand All @@ -30,8 +32,8 @@ jobs:
. /etc/os-release
case $ID in
alpine) apk update && apk upgrade && apk add git tar;;
centos|fedora) dnf -y upgrade && dnf -y install dnf-plugins-core git-core which;;
ubuntu) apt-get -y update && apt-get -y upgrade && apt-get -y install git;;
centos|fedora|rhel) dnf -y upgrade && dnf -y install dnf-plugins-core git-core which;;
debian|ubuntu) apt-get -y update && apt-get -y upgrade && apt-get -y install git;;
esac
- name: Checkout
Expand Down Expand Up @@ -86,7 +88,6 @@ jobs:

- name: Integration Test
run: |
vim -es -u $RUNNER_TEMP/.config/vim/$HOSTNAME/vimrc -i NONE -c PlugInstall -c qa
find $RUNNER_TEMP/.config/vim/$HOSTNAME/plugged/YouCompleteMe -name 'ycm_core*.so' | grep .
- name: Configure Project Name and Version
Expand Down
16 changes: 11 additions & 5 deletions build-aux/install-buildreqs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test -r $OS_RELEASE_FILE || exit

case $ID in
alpine)
$SUDO apk update
$SUDO apk add $pkgs_common
;;
centos)
Expand All @@ -31,13 +32,18 @@ case $ID in
;;
esac
$SUDO dnf --assumeyes config-manager --set-enabled $extra_repos
$SUDO dnf --assumeyes install epel-release epel-next-release
$SUDO dnf --assumeyes install --allowerasing $pkgs_common
$SUDO dnf --assumeyes --refresh install epel-release epel-next-release
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common
;;
debian|ubuntu)
$SUDO apt-get --assume-yes update
$SUDO apt-get --assume-yes install $pkgs_common
;;
fedora)
$SUDO dnf --assumeyes install $pkgs_common
$SUDO dnf --assumeyes --refresh install $pkgs_common
;;
ubuntu)
$SUDO apt-get --assume-yes install $pkgs_common
rhel)
$SUDO dnf --assumeyes --refresh install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common
;;
esac
41 changes: 29 additions & 12 deletions build-aux/install-reqs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ python3-pip
vim-enhanced
'

pkgs_debian='
awscli
apt-utils
clangd
exuberant-ctags
g++
locales-all
python3-dev
python3-pip
vim-nox
'

pkgs_fedora='
awscli
clang-tools-extra
Expand All @@ -46,14 +58,13 @@ python3-pip
vim-enhanced
'

pkgs_ubuntu='
awscli
clangd
exuberant-ctags
g++
python3-dev
pkgs_rhel='
clang-tools-extra
ctags
gcc-c++
platform-python-devel
python3-pip
vim
vim-enhanced
'

test -r $OS_RELEASE_FILE || exit
Expand All @@ -74,13 +85,19 @@ case $ID in
;;
esac
$SUDO dnf --assumeyes config-manager --set-enabled $extra_repos
$SUDO dnf --assumeyes install epel-release epel-next-release
$SUDO dnf --assumeyes install --allowerasing $pkgs_common $pkgs_centos
$SUDO dnf --assumeyes --refresh install epel-release epel-next-release
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common $pkgs_centos
;;
debian|ubuntu)
$SUDO apt-get --assume-yes update
$SUDO apt-get --assume-yes install $pkgs_common $pkgs_debian
;;
fedora)
$SUDO dnf --assumeyes install $pkgs_common $pkgs_fedora
$SUDO dnf --assumeyes --refresh install $pkgs_common $pkgs_fedora
;;
ubuntu)
$SUDO apt-get --assume-yes install $pkgs_common $pkgs_ubuntu
rhel)
$SUDO dnf --assumeyes --refresh install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
$SUDO dnf --assumeyes --refresh install --allowerasing $pkgs_common $pkgs_rhel
$SUDO pip3 install awscli
;;
esac
24 changes: 10 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,17 @@ AM_COND_IF([HOST_OS_DARWIN],
AM_CONDITIONAL([BIND_INPUTRC], [test "x$INPUTRC" != x])

# customization of PS1 color
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
EC_PS1_DEFAULT
AM_COND_IF([ENABLE_TOOLBOX_HOST],
[_ec_host_default=31],
[_ec_host_default=34])

AS_IF([test "x`id --user`" = x0],
[_ec_user_default=31],
[_ec_user_default=32])

QH_VAR_ENSURE([PS1_USER_COLOR], [bash prompt username color], [$_ec_user_default])
QH_VAR_ENSURE([PS1_HOST_COLOR], [bash prompt hostname color], [$_ec_host_default])
QH_VAR_ENSURE([PS1_GIT_COLOR], [bash prompt git status color], [32])
QH_VAR_ENSURE([PS1_PWD_COLOR], [bash prompt pwd color], [0])
QH_VAR_ENSURE([PS1_AWS_COLOR], [bash prompt aws profile color], [33])
[AS_CASE([$TERM],
[*256*], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;245'])],
[AS_VAR_SET([_ec_ps1_host_default], [37])])])

QH_VAR_ENSURE([PS1_USER_COLOR], [bash prompt username color], [$_ec_ps1_user_default])
QH_VAR_ENSURE([PS1_HOST_COLOR], [bash prompt hostname color], [$_ec_ps1_host_default])
QH_VAR_ENSURE([PS1_GIT_COLOR], [bash prompt git status color], [$_ec_ps1_git_default])
QH_VAR_ENSURE([PS1_PWD_COLOR], [bash prompt pwd color], [0])
QH_VAR_ENSURE([PS1_AWS_COLOR], [bash prompt aws profile color], [$_ec_ps1_aws_default])

## python ##

Expand Down
11 changes: 7 additions & 4 deletions data/bash/common/bashrc.d/ps1.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
# use a cygwin-style prompt

# only do this in interactive shells
echo $- | grep i &> /dev/null || return
echo $- | @GREP@ i &> /dev/null || return

case "$TERM" in

xterm* | cygwin)
PS1="\[\e]0;\u@\h \w\a\]\n\[\e[1;@PS1_USER_COLOR@m\]\u\[\e[0m\]@\[\e[1;@PS1_HOST_COLOR@m\]@TOOLBOX_NAME@ \[\e[1;@PS1_AWS_COLOR@m\]\$(__aws_profile)\[\e[1;@PS1_GIT_COLOR@m\]\$(__git_ps1)\n\[\e[@PS1_PWD_COLOR@m\]\w\[\e[0m\]\n\$ ";;
PS1="\[\e]0;\u@\h \w\a\]\n\[\e[1;@PS1_USER_COLOR@m\]\u\[\e[0m\]@\[\e[1;@PS1_HOST_COLOR@m\]@TOOLBOX_NAME@ \[\e[1;@PS1_AWS_COLOR@m\]\$(__aws_profile)\[\e[1;@PS1_GIT_COLOR@m\]\$(__git_ps1)\n\[\e[@PS1_PWD_COLOR@m\]\w\[\e[0m\]\n\$ "
;;

linux)
PS1="\n\[\e[1;@PS1_USER_COLOR@m\]\u\[\e[0m\]@\[\e[1;@PS1_HOST_COLOR@m\]@TOOLBOX_NAME@ \[\e[1;@PS1_AWS_COLOR@m\]\$(__aws_profile)\[\e[1;@PS1_GIT_COLOR@m\]\$(__git_ps1)\n\[\e[@PS1_PWD_COLOR@m\]\w\[\e[0m\]\n\$ ";;
PS1="\n\[\e[1;@PS1_USER_COLOR@m\]\u\[\e[0m\]@\[\e[1;@PS1_HOST_COLOR@m\]@TOOLBOX_NAME@ \[\e[1;@PS1_AWS_COLOR@m\]\$(__aws_profile)\[\e[1;@PS1_GIT_COLOR@m\]\$(__git_ps1)\n\[\e[@PS1_PWD_COLOR@m\]\w\[\e[0m\]\n\$ "
;;

*)
PS1='\n\u@\h \w\n\$ ';;
PS1='\n\u@\h \w\n\$ '
;;

esac
10 changes: 0 additions & 10 deletions data/ssh/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,9 @@ conf-data-perms:
$(keydir):
$(MKDIR_P) -m 0700 $(DESTDIR)$@

.PHONY: rm-keydir
rm-keydir:
rmdir $(DESTDIR)$(keydir)

$(knownhostsdir):
$(MKDIR_P) -m 0700 $(DESTDIR)$@

.PHONY: rm-knownhostsdir
rm-knownhostsdir:
rmdir $(DESTDIR)$(knownhostsdir)

install-data-local: $(keydir) $(knownhostsdir)

uninstall-local: rm-keydir rm-knownhostsdir

install-data-hook: sshdir-perms ssh-data-perms confdir-perms conf-data-perms
7 changes: 6 additions & 1 deletion data/vim/option.vim
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
"" option.vim

colorscheme desert
set autowrite
set expandtab
set path+=/usr/bin,/usr/local/bin
set secure
set shiftwidth=4
set tags+=./tags,tags
set wildmode=list:longest

if has('termguicolors')
set termguicolors
endif

colorscheme desert
9 changes: 7 additions & 2 deletions data/vim/vim-plug.vim.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ call plug#begin('@vimpluggeddir@')

" plugins
Plug 'mmarchini/bpftrace.vim'

if ( v:version >= 802 )
Plug 'vim/colorschemes'
endif

@VIM_PLUG_CMAKE_FILE@
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
@VIM_PLUG_CMAKE_FILE@
Plug 'vivien/vim-linux-coding-style'
Plug 'tpope/vim-surround'
@VIM_PLUG_YCM_FILE@

" Initialize plugin system
Expand Down
66 changes: 55 additions & 11 deletions m4/envconf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ AS_VAR_SET_IF([$1],
[alpine], [AS_VAR_SET([$1], [detwiler])],
[centos], [AS_CASE([$VERSION_ID],
[8], [AS_VAR_SET([$1], [detwiler])],
[AS_VAR_SET([$1], [ycm-core])])],
[AS_VAR_SET([$1], [ycm-core])])],
[ubuntu], [AS_CASE([$VERSION_ID],
[18.04], [AS_VAR_SET([$1], [detwiler])],
[AS_VAR_SET([$1], [ycm-core])])],
[AS_VAR_SET([$1], [ycm-core])])
[AS_VAR_SET([$1], [ycm-core])])],
[AS_VAR_SET([$1], [ycm-core])])
AS_VAR_COPY([VERSION], [_ec_version])
AC_MSG_RESULT([$$1])])
]) # EC_VIM_YCM_OWNER
Expand All @@ -50,14 +50,14 @@ AS_VAR_SET_IF([$1],
[3.13*], [AS_VAR_SET([$1], [llvm-10])],
[3.14*], [AS_VAR_SET([$1], [llvm-11])],
[3.15*], [AS_VAR_SET([$1], [llvm-12])],
[AS_VAR_SET([$1], [master])])],
[AS_VAR_SET([$1], [master])])],
[centos], [AS_CASE([$VERSION_ID],
[8], [AS_VAR_SET([$1], [vim-7.4.1578])],
[AS_VAR_SET([$1], [master])])],
[AS_VAR_SET([$1], [master])])],
[ubuntu], [AS_CASE([$VERSION_ID],
[18.04], [AS_VAR_SET([$1], [vim-7.4.1578])],
[AS_VAR_SET([$1], [master])])],
[AS_VAR_SET([$1], [master])])
[AS_VAR_SET([$1], [master])])],
[AS_VAR_SET([$1], [master])])
AS_VAR_COPY([VERSION], [_ec_version])
AC_MSG_RESULT([$$1])])
]) # EC_VIM_YCM_REF
Expand All @@ -82,14 +82,14 @@ AS_VAR_SET_IF([$1],
[alpine], [AS_CASE([$VERSION_ID],
[3.13*], [AS_VAR_SET([$1], [--clangd-completer])],
[3.14*], [AS_VAR_SET([$1], [--clangd-completer])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[centos], [AS_CASE([$VERSION_ID],
[8], [AS_VAR_SET([$1], [--clangd-completer])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[ubuntu], [AS_CASE([$VERSION_ID],
[18.04], [AS_VAR_SET([$1], [--clangd-completer])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])],
[AS_VAR_SET([$1], ['--clangd-completer --force-sudo'])])
AS_VAR_COPY([VERSION], [_ec_version])
AC_MSG_RESULT([$$1])])
]) # EC_VIM_YCM_ARGS
Expand Down Expand Up @@ -126,3 +126,47 @@ AS_VAR_SET_IF([$1],
[AS_VAR_SET([$1],[$HOSTNAME])])
AC_MSG_RESULT([$$1])])
]) # EC_TOOLBOX_NAME

# EC_PS1_DEFAULT
# ----------------------------------------------------------
# Set the default colors for various PS1 elements. Use 256
# color options if available. Results are stored in the
# following variables.
# * _ec_ps1_user_default
# * _ec_ps1_host_default
# * _ec_ps1_git_default
# * _ec_ps1_aws_default
AC_DEFUN([EC_PS1_DEFAULT],
[
AS_VAR_SET([_ec_user_id], [m4_esyscmd_s([id --user])])
AS_VAR_COPY([_ec_version], [VERSION])
QH_OS_RELEASE
AS_CASE([$TERM],
[*256*], [AS_CASE([$_ec_user_id],
[0], [AS_VAR_SET([_ec_ps1_user_default], ['38;5;9'])],
[AS_VAR_SET([_ec_ps1_user_default], ['38;5;28'])])
AS_CASE([$ID],
[alpine], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;24'])],
[centos], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;214'])],
[debian], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;161'])],
[fedora], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;33'])],
[rhel], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;196'])],
[ubuntu], [AS_VAR_SET([_ec_ps1_host_default], ['38;5;202'])],
[AS_VAR_SET([_ec_ps1_host_default], ['38;5;6'])])
AS_VAR_SET([_ec_ps1_git_default], ['38;5;202'])
AS_VAR_SET([_ec_ps1_aws_default], ['38;5;214'])],
[AS_CASE([$_ec_user_id],
[0], [AS_VAR_SET([_ec_ps1_user_default], [31])],
[AS_VAR_SET([_ec_ps1_user_default], [32])])
AS_CASE([$ID],
[alpine], [AS_VAR_SET([_ec_ps1_host_default], [36])],
[centos], [AS_VAR_SET([_ec_ps1_host_default], [33])],
[debian], [AS_VAR_SET([_ec_ps1_host_default], [35])],
[fedora], [AS_VAR_SET([_ec_ps1_host_default], [34])],
[rhel], [AS_VAR_SET([_ec_ps1_host_default], [31])],
[ubuntu], [AS_VAR_SET([_ec_ps1_host_default], [35])],
[AS_VAR_SET([_ec_ps1_host_default], [32])])
AS_VAR_SET([_ec_ps1_git_default], [31])
AS_VAR_SET([_ec_ps1_aws_default], [33])])
AS_VAR_COPY([VERSION], [_ec_version])
]) # EC_PS1_DEFAULT

0 comments on commit 0b053eb

Please sign in to comment.