From e8ed30249ab02a6fa973803005a8f3b582b9cced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20R=C4=B1za=20Keskin?= Date: Fri, 7 Feb 2020 08:59:27 +0000 Subject: [PATCH] sulinstrapt eklendi --- Makefile | 3 ++- inary/util.py | 9 +++++---- scripts/sulinstrapt | 26 ++++++++++++++++++++++++++ scripts/update-inary-cache | 16 ++++++++++++++++ setup.py | 2 ++ shell-complete/bash-complete.sh | 25 +++++++++++++++++++++++++ 6 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 scripts/sulinstrapt create mode 100755 scripts/update-inary-cache create mode 100644 shell-complete/bash-complete.sh diff --git a/Makefile b/Makefile index de9da8df..1eea00a3 100644 --- a/Makefile +++ b/Makefile @@ -8,4 +8,5 @@ build: python3 setup.py build install: python3 setup.py install - install inary-cli /usr/bin/inary + ln -s /usr/bin/inary-cli /usr/bin/inary || true + install shell-complete/bash-complete.sh /usr/share/bash-completion/completions/inary diff --git a/inary/util.py b/inary/util.py index 055c47c5..d30fa6de 100644 --- a/inary/util.py +++ b/inary/util.py @@ -393,10 +393,11 @@ def mvprintw(x,y,msg=''): printw(msg) def noecho(enabled=True): - if(enabled): - printw("\x1b[?25l") - else: - printw("\x1b[?25h") + if(ctx.get_option('no_color')==False): + if(enabled): + printw("\x1b[?25l") + else: + printw("\x1b[?25h") def attron(attribute): """Attribute enable""" diff --git a/scripts/sulinstrapt b/scripts/sulinstrapt new file mode 100644 index 00000000..f84f332e --- /dev/null +++ b/scripts/sulinstrapt @@ -0,0 +1,26 @@ +#!/bin/sh +#sulinstrapt betiği ile sulinos chroot oluşturabilirsiniz veya diskinize kurulum yapabilirsiniz + +if [ "$1" == "" ] || [ "$1" == "-*" ] +then + echo "Usage: sulinstrapt [directory]" + exit 0 +fi +sulin="$1" +if [ $UID -ne 0 ] +then + echo "You must be root!" + exit 1 +fi +if [ -d "$sulin" ] +then + echo "$sulin already exist" +fi +if [ -f "$sulin" ] +then + echo "$sulin is a file. You must delete or move." + exit 1 +fi +inary ar sulin https://master.dl.sourceforge.net/project/sulinos/SulinRepository/inary-index.xml -D$sulin +inary it -c system.base -y --ignore-scom -D$sulin +cp -prf $sulin/usr/share/baselayout/* $sulin/etc/ diff --git a/scripts/update-inary-cache b/scripts/update-inary-cache new file mode 100755 index 00000000..b8054348 --- /dev/null +++ b/scripts/update-inary-cache @@ -0,0 +1,16 @@ +#!/bin/bash +if [ $UID -ne 0 ] ; then + echo "You must be root!" + exit 1 +fi +inary dc +inary ur +echo +echo "Listing avaiable..." +inary la --no-color | awk -F ' ' '{print $1}' > /var/cache/inary/avaiable +echo "Listing installed..." +inary li --no-color | awk -F ' ' '{print $1}' > /var/cache/inary/installed +echo "Listing repos..." +ls /var/lib/inary/index/ > /var/cache/inary/repos +echo +echo "Done" diff --git a/setup.py b/setup.py index fba5e226..ccb2b188 100644 --- a/setup.py +++ b/setup.py @@ -205,6 +205,8 @@ setup(name="inary", scripts=['inary-cli', 'scripts/pspec2po', 'scripts/revdep-rebuild', + 'scripts/sulinstrapt', + 'scripts/update-inary-cache', 'scripts/version-bump'], classifiers=[ 'Development Status :: 5 - Production/Stable', diff --git a/shell-complete/bash-complete.sh b/shell-complete/bash-complete.sh new file mode 100644 index 00000000..c7df9eb5 --- /dev/null +++ b/shell-complete/bash-complete.sh @@ -0,0 +1,25 @@ +_inary() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="ar bl bi check cm cp dc dt dr em emup er fc graph hs ix info it la lc li ln ln lp lr lu rdb rp ro rr sr sf ur up" + + if [[ ${cur} == * ]] && [ ${prev} == inary ] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + fi + if [[ ${cur} == * ]] && [ ${prev} == it ] ; then + avaiable=$(cat /var/cache/inary/avaiable) + COMPREPLY=( $(compgen -W "${avaiable}" -- ${cur}) ) + fi + if [[ ${cur} == * ]] && [ ${prev} == rm ] ; then + avaiable=$(cat /var/cache/inary/installed) + COMPREPLY=( $(compgen -W "${avaiable}" -- ${cur}) ) + fi + if [[ ${cur} == * ]] && [ ${prev} == rr ] ; then + avaiable=$(cat /var/cache/inary/repos) + COMPREPLY=( $(compgen -W "${avaiable}" -- ${cur}) ) + fi +} +complete -F _inary inary -- 2.18.1