diff --git a/INSTALL.sh b/INSTALL.sh index 1647b61..5b2278b 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh BINDIR=/usr/bin CONFDIR=/etc @@ -7,8 +7,17 @@ PORT_DIR=/usr/ports REVDEPD=/etc/revdep.d REVDEPCONF=/etc/revdep.conf -mkdir -pv ${DESTDIR}{${BINDIR},${CONFDIR},${PORT_DIR},${REVDEPD}} -install -m755 revdep pkgadd pkgdel pkgbuild scratch updateconf ${DESTDIR}${BINDIR} +install -d ${DESTDIR}${BINDIR} +install -d ${DESTDIR}${CONFDIR} +install -d ${DESTDIR}${PORT_DIR} +install -d ${DESTDIR}${REVDEPD} + +install -dm777 ${DESTDIR}${CACHE_DIR}/packages +install -dm777 ${DESTDIR}${CACHE_DIR}/sources +install -dm777 ${DESTDIR}${CACHE_DIR}/log +install -dm777 ${DESTDIR}${CACHE_DIR}/work + +install -m755 revdep pkgadd pkgdel pkgbuild pkgquery scratch updateconf ${DESTDIR}${BINDIR} install -m644 scratchpkg.conf scratchpkg.repo ${DESTDIR}${CONFDIR} -install -dm777 ${DESTDIR}${CACHE_DIR}/{packages,sources,log,work} + install -m644 revdep.conf ${DESTDIR}${REVDEPCONF} diff --git a/pkgadd b/pkgadd index 674d907..d1873d9 100755 --- a/pkgadd +++ b/pkgadd @@ -64,6 +64,22 @@ Options: EOF } +extract_opts() { + while [ "$1" ]; do + case $1 in + --*) opts="$opts $1";; + -*) char=${#1}; count=1 + while [ "$count" != "$char" ]; do + count=$((count+1)) + opts="$opts -$(echo $1 | cut -c $count)" + done;; + *) opts="$opts $1" + esac + shift + done + echo $opts +} + parse_opts() { if [ -z "$1" ]; then SHOWHELP=yes @@ -103,7 +119,7 @@ isinstalled() { fi } -parse_opts "$@" +parse_opts $(extract_opts "$@") INDEX_DIR="$ROOT_DIR/var/lib/scratchpkg/index" LOCK_FILE="$ROOT_DIR/var/lib/scratchpkg/spkg.lock" diff --git a/pkgbuild b/pkgbuild index 49ad39b..0c781a4 100755 --- a/pkgbuild +++ b/pkgbuild @@ -524,8 +524,24 @@ Options: EOF } +extract_opts() { + while [ "$1" ]; do + case $1 in + --*) opts="$opts $1";; + -*) char=${#1}; count=1 + while [ "$count" != "$char" ]; do + count=$((count+1)) + opts="$opts -$(echo $1 | cut -c $count)" + done;; + *) opts="$opts $1" + esac + shift + done + echo $opts +} + main() { - parse_opts "$@" + parse_opts $(extract_opts "$@") if [ -f "$PKGBUILD_CONF" ]; then source "$PKGBUILD_CONF" diff --git a/pkgdel b/pkgdel index 5c6d56d..d0a816c 100755 --- a/pkgdel +++ b/pkgdel @@ -58,6 +58,22 @@ Options: EOF } +extract_opts() { + while [ "$1" ]; do + case $1 in + --*) opts="$opts $1";; + -*) char=${#1}; count=1 + while [ "$count" != "$char" ]; do + count=$((count+1)) + opts="$opts -$(echo $1 | cut -c $count)" + done;; + *) opts="$opts $1" + esac + shift + done + echo $opts +} + parse_opts() { if [ -z "$1" ]; then SHOWHELP=yes @@ -90,8 +106,8 @@ isinstalled() { return 1 fi } - -parse_opts "$@" + +parse_opts $(extract_opts "$@") INDEX_DIR="$ROOT_DIR/var/lib/scratchpkg/index" LOCK_FILE="$ROOT_DIR/var/lib/scratchpkg/spkg.lock" diff --git a/pkgquery b/pkgquery index 8e32e89..ba93fdb 100755 --- a/pkgquery +++ b/pkgquery @@ -320,7 +320,7 @@ print_runhelp_msg() { } BUILD_SCRIPT="spkgbuild" -INDEX_DIR="$ROOT_DIR/var/lib/scratchpkg/index" +INDEX_DIR="/var/lib/scratchpkg/index" REPO_FILE="/etc/scratchpkg.repo" if [ -f "$REPO_FILE" ]; then diff --git a/revdep b/revdep index 7b47965..da8571e 100755 --- a/revdep +++ b/revdep @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # scratchpkg # @@ -46,7 +46,8 @@ EOF } confirm() { - read -r -p "$1 (Y/n) " response + printf "$1 (Y/n) " + read -r response case "$response" in [Nn][Oo]|[Nn]) echo "$2"; exit 2 ;; *) : ;; @@ -105,11 +106,11 @@ rebuild() { rev_exclude() { # excluded dirs EXCLUDE_DIRS="$(grep -v ^# /etc/revdep.conf 2>/dev/null | grep /$ | uniq | sed 's/\/*$//g')" - EXCLUDE_DIRS+=" $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep /$ | uniq | sed 's/\/*$//g')" + EXCLUDE_DIRS="$EXCLUDE_DIRS $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep /$ | uniq | sed 's/\/*$//g')" for dd in $EXCLUDE_DIRS; do if [ -d $dd ]; then - _DIRS+=" $dd" + _DIRS="$_DIRS $dd" ged="$ged -e ^$dd" fi done @@ -117,16 +118,16 @@ rev_exclude() { EXCLUDE_DIRS=$(echo $_DIRS | tr ' ' '\n' | sort | uniq) for d in $EXCLUDE_DIRS; do - EXCLUDED_DIRS+="-path $d -prune -o " + EXCLUDED_DIRS="$EXCLUDED_DIRS -path $d -prune -o " done # excluded files EXCLUDE_FILES="$(grep -v ^# /etc/revdep.conf 2>/dev/null | grep -v /$ | grep ^/)" - EXCLUDE_FILES+=" $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep -v /$ | grep ^/)" + EXCLUDE_FILES="$EXCLUDE_FILES $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep -v /$ | grep ^/)" for ff in $EXCLUDE_FILES; do if [ -f $ff ]; then - _FILES+=" $ff" + _FILES="$_FILES $ff" gef="$gef -e ^$ff$" fi done @@ -134,17 +135,17 @@ rev_exclude() { EXCLUDE_FILES=$(echo $_FILES | tr ' ' '\n' | sort | uniq) for f in $EXCLUDE_FILES; do - EXCLUDED_FILES+="! -path $f " + EXCLUDED_FILES="$EXCLUDED_FILES ! -path $f " done # excluded libraries EXCLUDE_LIBS="$(grep -v ^# /etc/revdep.conf 2>/dev/null | grep -v ^/ | uniq | grep ".*.so.*")" - EXCLUDE_LIBS+=" $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep -v ^/ | uniq | grep ".*.so.*")" + EXCLUDE_LIBS="$EXCLUDE_LIBS $(grep -v ^# /etc/revdep.d/*.conf 2>/dev/null | cut -d : -f2 | grep -v ^/ | uniq | grep ".*.so.*")" EXCLUDED_LIBS=$(echo $EXCLUDE_LIBS | tr ' ' '\n' | sort | uniq) } -trap "interrupted" SIGHUP SIGINT SIGQUIT SIGTERM +trap "interrupted" 1 2 3 15 # package database directory INDEX_DIR="/var/lib/scratchpkg/index" @@ -152,7 +153,7 @@ SEARCH_DIRS="/bin /usr/bin /sbin /usr/sbin /lib /usr/lib /lib64 /usr/lib64 /usr/ parse_opt $@ -if [ "$UID" != 0 ] && [ "$REBUILD" = 1 ]; then +if [ "$(id -u)" != 0 ] && [ "$REBUILD" = 1 ]; then echo "$(basename $0) need to run as root to rebuild & reinstall package" exit 1 fi @@ -165,16 +166,16 @@ fi # get search extra dirs while read -r line; do - if [[ "${line::1}" = "/" ]]; then - EXTRA_SEARCH_DIRS+="$line " + if [ "$(echo $line | cut -c 1)" = "/" ]; then + EXTRA_SEARCH_DIRS="$EXTRA_SEARCH_DIRS $line " fi done < /etc/ld.so.conf if [ -d /etc/ld.so.conf.d/ ]; then for dir in /etc/ld.so.conf.d/*.conf; do while read -r line; do - if [[ "${line::1}" = "/" ]]; then - EXTRA_SEARCH_DIRS+="$line " + if [ "$(echo $line | cut -c 1)" = "/" ]; then + EXTRA_SEARCH_DIRS="$EXTRA_SEARCH_DIRS $line " fi done < $dir done @@ -187,12 +188,12 @@ fi # search dirs TARGET_SEARCH_DIRS="$SEARCH_DIRS $EXTRA_SEARCH_DIRS" -FILE_LIST=$(mktemp) || { echo "Can't create temporary file .Aborting..."; exit 1; } +FILE_LIST="/tmp/.revdep.$$" echo "SEARCH DIRS:" for d in $TARGET_SEARCH_DIRS; do if [ -d $d ]; then - SEARCH_DIRS+=" $d" + SEARCH_DIRS="$SEARCH_DIRS $d" echo " $d" fi done @@ -231,11 +232,11 @@ if [ "$PKG" ]; then else filterdir=cat fi - echo -n "Find '$PKG' files... " + printf "Find '$PKG' files... " sed 's/^/\//' $INDEX_DIR/$PKG/.files | grep $gx | $filterfile | $filterdir > $FILE_LIST else - echo -n "Find all files... " - find ${SEARCH_DIRS[@]} $EXCLUDED_DIRS $EXCLUDED_FILES -type f \( -perm /+u+x -o -name '*.so' -o -name '*.so.*' \) -print 2> /dev/null | sort -u > $FILE_LIST + printf "Find all files... " + find $SEARCH_DIRS $EXCLUDED_DIRS $EXCLUDED_FILES -type f \( -perm /+u+x -o -name '*.so' -o -name '*.so.*' \) -print 2> /dev/null | sort -u > $FILE_LIST fi total=$(wc -l $FILE_LIST | awk '{print $1}') @@ -245,36 +246,36 @@ echo "$total files found" echo "Checking for broken linkage..." -while IFS=' ' read -r line; do +while read -r line; do count=$(( count + 1 )) libname=$(basename "$line") - echo -ne " $(( 100*count/total ))% $libname\033[0K\r" + printf " $(( 100*count/total ))%% $libname\033[0K\r" case "$(file -bi "$line")" in *application/x-sharedlib* | *application/x-executable* | *application/x-pie-executable*) if ldd $line 2>/dev/null | grep -q "not found"; then LIB_NAME=$(ldd $line 2>/dev/null | grep "not found" | sort | uniq | awk '{print $1}') for l in $LIB_NAME; do if ! echo $EXCLUDED_LIBS | grep -qw $l; then - NEW_LIB_NAME+=" $l" + NEW_LIB_NAME="$NEW_LIB_NAME $l" fi done LIB_NAME=$NEW_LIB_NAME - [[ $LIB_NAME ]] || continue + [ "$LIB_NAME" ] || continue PKG_NAME=$(echo $line | sed 's#^/##') PKG_NAME=$(grep -Rx $PKG_NAME "$INDEX_DIR"/*/.files | cut -d : -f1) - [[ $PKG_NAME ]] || continue + [ "$PKG_NAME" ] || continue PKG_NAME=$(dirname $PKG_NAME) PKG_NAME=$(basename $PKG_NAME) echo $expkg | tr ' ' '\n' | grep -qx $PKG_NAME && continue REQ_LIB=$(objdump -p $line 2>/dev/null | grep NEEDED | awk '{print $2}' | tr '\n' ' ') for i in $LIB_NAME; do - [ "$PRINTALL" = 1 ] && echo -e " $PKG_NAME -> $line (requires $i)" + [ "$PRINTALL" = 1 ] && echo " $PKG_NAME -> $line (requires $i)" if echo $REQ_LIB | tr ' ' '\n' | grep -qx $i; then - [ "$PRINTALL" = 1 ] || echo -e " $PKG_NAME -> $line (requires $i)" - if echo "${ALLPKG[@]}" | tr ' ' '\n' | grep -qx "$PKG_NAME"; then + [ "$PRINTALL" = 1 ] || echo " $PKG_NAME -> $line (requires $i)" + if echo "$ALLPKG" | tr ' ' '\n' | grep -qx "$PKG_NAME"; then continue else - ALLPKG+="$PKG_NAME " + ALLPKG="$ALLPKG $PKG_NAME" fi fi done @@ -284,13 +285,13 @@ while IFS=' ' read -r line; do unset NEW_LIB_NAME done < $FILE_LIST -echo -ne "\033[0K" +printf "\033[0K" if [ "$ALLPKG" ]; then echo echo "Broken package(s):" for rebuild in $ALLPKG; do - echo -e " $rebuild" + echo " $rebuild" done if [ "$REBUILD" = 1 ]; then rebuild diff --git a/scratch b/scratch index d21f149..44b01c6 100755 --- a/scratch +++ b/scratch @@ -71,8 +71,8 @@ needroot() { getportpath() { for repo in $PORT_REPO; do - if [[ -f $repo/$1/$BUILD_SCRIPT ]]; then - dirname $repo/$1/$BUILD_SCRIPT + if [ -f "$repo/$1/$BUILD_SCRIPT" ]; then + dirname "$repo/$1/$BUILD_SCRIPT" return 0 fi done @@ -82,7 +82,7 @@ getportpath() { vercomp() { if [ "$1" = "$2" ]; then return 0 # same version - elif [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]; then + elif [ "$1" = "$(echo "$1\n$2" | sort -V | head -n1)" ]; then return 1 # $1 lower than $2 else return 2 # $1 higher than $2 @@ -100,7 +100,6 @@ allinstalled() { } get_depends() { - local pkg=$1 ppath=$(getportpath $pkg) || return 0 grep "^# depends[[:blank:]]*:" $ppath/$BUILD_SCRIPT \ | sed 's/^# depends[[:blank:]]*:[[:blank:]]*//' \ @@ -110,7 +109,8 @@ get_depends() { } confirm() { - read -r -p "$1 (Y/n) " response + printf "$1 (Y/n) " + read -r response case "$response" in [Nn][Oo]|[Nn]) echo "$2"; return 2 ;; *) : ;; @@ -133,7 +133,7 @@ needarg() { } isinstalled() { - if [ -s $INDEX_DIR/$1/.pkginfo ] && [[ $(grep $1 $INDEX_DIR/$1/.pkginfo) ]]; then + if [ -s "$INDEX_DIR/$1/.pkginfo" ] && [ "$(grep $1 $INDEX_DIR/$1/.pkginfo)" ]; then return 0 else return 1 @@ -151,9 +151,9 @@ scratch_integrity() { cat $INDEX_DIR/$1/.files | while read -r line; do if [ ! -e "$line" ]; then if [ -L "$line" ]; then - echo -e "${YELLOW}broken symlink${CRESET} $1: /$line" + printf "${YELLOW}broken symlink${CRESET} $1: /$line" else - echo -e "${RED}file missing${CRESET} $1: /$line" + printf "${RED}file missing${CRESET} $1: /$line" fi fi done @@ -168,16 +168,15 @@ scratch_integrity() { cat $INDEX_DIR/$pkg/.files | while read -r line; do if [ ! -e "$line" ]; then if [ -L "$line" ]; then - echo -e "${YELLOW}broken symlink${CRESET} $pkg: /$line" + printf "${YELLOW}broken symlink${CRESET} $pkg: /$line" else - echo -e "${RED}file missing${CRESET} $pkg: /$line" + printf "${RED}file missing${CRESET} $pkg: /$line" fi fi done done cd - >/dev/null - fi - + fi [ "$(id -u)" != "0" ] && msg "${YELLOW}(check integrity is recommended run as root or using sudo)${CRESET}" } @@ -232,12 +231,11 @@ scratch_sync() { fi grep -Ev '^(#|$)' "$REPO_FILE" | awk '{print $1,$2}' | while read -r repodir repourl; do - if [ -n "$repodir" ] && [ -n "$repourl" ]; then - httpup sync $repourl $repodir - if [ $? != 0 ]; then + if [ "$repodir" ] && [ "$repourl" ]; then + httpup sync $repourl $repodir || { msgerr "Failed sync from $repourl" exit 1 - fi + } fi done } @@ -267,13 +265,13 @@ post_triggers() { if [ -e "$dir" ]; then if [ "$uid" != '-' ]; then getent passwd $uid >/dev/null - if [[ "$?" = 0 ]]; then + if [ "$?" = 0 ]; then chown "$uid" "$dir" fi fi if [ "$gid" != '-' ]; then getent group $gid >/dev/null - if [[ "$?" = 0 ]]; then + if [ "$?" = 0 ]; then chgrp "$gid" "$dir" fi fi @@ -319,7 +317,7 @@ post_triggers() { if [ "$trig_5" = 1 ] && [ $(type -p gtk-update-icon-cache) ]; then echo "trigger: Updating icon theme caches..." for dir in /usr/share/icons/* ; do - if [[ -e $dir/index.theme ]]; then + if [ -e $dir/index.theme ]; then gtk-update-icon-cache -q $dir &>/dev/null else rm -f $dir/icon-theme.cache @@ -338,7 +336,7 @@ post_triggers() { for dir in $(find /usr/share/fonts -maxdepth 1 -type d \( ! -path /usr/share/fonts -a ! -name X11 \)) /usr/share/fonts/X11/*; do rm -f $dir/fonts.{scale,dir} $dir/.uuid rmdir --ignore-fail-on-non-empty $dir - [[ -d $dir ]] || continue + [ -d "$dir" ] || continue mkfontdir $dir mkfontscale $dir done @@ -478,7 +476,6 @@ pre_triggers() { } scratch_build() { - needarg $@ while [ "$1" ]; do case $1 in -i|-u|-r|-g|-p) ;; @@ -488,7 +485,7 @@ scratch_build() { shift done [ "$PKGNAME" ] || { - echo "Please specify package(s) to install." + echo "Please specify package(s) to build." return 1 } for pkg in $PKGNAME; do @@ -508,7 +505,6 @@ scratch_build() { scratch_install() { needroot "Installing package" - needarg $@ while [ "$1" ]; do case $1 in -i|-u) ;; @@ -554,6 +550,7 @@ scratch_install() { return "$error" fi if [ "$NO_DEP" = 1 ]; then + error=0 for ii in $PKGNAME; do if [ ! $(getportpath $ii) ]; then echo "Package '$ii' not found." @@ -567,14 +564,14 @@ scratch_install() { error=1 break } - done_pkg+="$done_pkg $ii" + done_pkg="$done_pkg $ii" cd - >/dev/null fi done settermtitle "Triggering install hook" [ "$done_pkg" ] && scratch_trigger $done_pkg settermtitle "Installing done" - [ "$error" = 1 ] && return 1 || return 0 + return "$error" fi for i in $PKGNAME; do if [ ! $(getportpath $i) ]; then @@ -629,26 +626,8 @@ scratch_install() { fi } -outdatepkg() { - for pkg in $(allinstalled); do - if [ ! -e "$INDEX_DIR/$pkg/.lock" ] && getportpath $pkg >/dev/null; then - . $(getportpath $pkg)/$BUILD_SCRIPT - if [ -z "$name" ] || [ -z "$version" ]; then - continue - fi - iversion=$(installed_pkg_info version $pkg) - irelease=$(installed_pkg_info release $pkg) - if [ "$release" != "$irelease" ] || [ "$version" != "$iversion" ]; then - echo $name - fi - unset iversion irelease version release - fi - done -} - scratch_remove() { needroot "Removing package" - needarg $@ while [ "$1" ]; do case $1 in -y|--yes) NOCONFIRM=1;; @@ -702,9 +681,25 @@ scratch_remove() { settermtitle "$pkgcount package(s) removed" } +outdatepkg() { + for pkg in $(allinstalled); do + if [ ! -e "$INDEX_DIR/$pkg/.lock" ] && getportpath $pkg >/dev/null; then + . $(getportpath $pkg)/$BUILD_SCRIPT + if [ -z "$name" ] || [ -z "$version" ]; then + continue + fi + iversion=$(installed_pkg_info version $pkg) + irelease=$(installed_pkg_info release $pkg) + if [ "$release" != "$irelease" ] || [ "$version" != "$iversion" ]; then + echo $name + fi + unset iversion irelease version release + fi + done +} + scratch_sysup() { - needroot "Upgrading package" - + needroot "Upgrading package" while [ "$1" ]; do case $1 in -i|-u|-r) ;; @@ -811,7 +806,7 @@ scratch_upgrade() { msgerr "Package '$pkg' not exist." continue else - source $(getportpath $pkg)/$BUILD_SCRIPT + . $(getportpath $pkg)/$BUILD_SCRIPT if [ "$(installed_pkg_info version $pkg)-$(installed_pkg_info release $pkg)" = "$version-$release" ]; then msg "Package '$pkg' is up to date." continue @@ -847,7 +842,7 @@ scratch_upgrade() { confirm "Continue upgrade/install these package(s)?" "Package upgrade cancelled." || exit $? echo } - total=$(( tup + tnew)) + total=$(( tup + tnew )) count=0 error=0 if [ "$newpkg" ]; then @@ -897,19 +892,19 @@ scratch_outdate() { if [ "$version" != "$iversion" ]; then vercomp $version $iversion if [ $? = 2 ]; then - echo -e "$outdatemsg" + echo "$outdatemsg" OUTDATE=yes elif [ $? = 1 ]; then - echo -e "$newerinstmsg" + echo "$newerinstmsg" OUTDATE=yes fi elif [ "$release" != "$irelease" ]; then vercomp $release $irelease if [ $? = 2 ]; then - echo -e "$outdatemsg" + echo "$outdatemsg" OUTDATE=yes elif [ $? = 1 ]; then - echo -e "$newerinstmsg" + echo "$newerinstmsg" OUTDATE=yes fi fi @@ -920,20 +915,6 @@ scratch_outdate() { [ ! "$OUTDATE" ] && msg "All packages are up to date." } -clearpkgcache() { - if [ ${#ALL_PACKAGES[@]} -gt 0 ]; then - for pkg in ${ALL_PACKAGES[@]}; do - rm -v $PACKAGE_DIR/$pkg - done - fi - - if [ ${#ALL_SOURCES[@]} -gt 0 ]; then - for src in ${ALL_SOURCES[@]}; do - rm -v $SOURCE_DIR/$src - done - fi -} - scratch_cache() { needroot "Clear old caches" @@ -946,7 +927,13 @@ scratch_cache() { [ -f /etc/scratchpkg.conf ] && . /etc/scratchpkg.conf - touch $allcachepkg $allcachesrc + touch \ + $allcachepkg \ + $allcachesrc \ + $keepcachepkg \ + $keepcachesrc \ + $diffcachepkg \ + $diffcachesrc if [ "$(find $PACKAGE_DIR -mindepth 1 -print -quit 2>/dev/null)" ]; then for list in "$PACKAGE_DIR"/*; do @@ -965,7 +952,7 @@ scratch_cache() { for port in $repo/*/$BUILD_SCRIPT; do . $port echo "$name-$version-$release.spkg.tar.$COMPRESSION_MODE" >> "$keepcachepkg" - if [ -n "$source" ]; then + if [ "$source" ]; then for src in $source; do if echo $src | grep -Eq "(ftp|http|https)://"; then if echo $src | grep -Eq "::(ftp|http|https)://"; then @@ -1010,10 +997,10 @@ scratch_cache() { confirm "Clear old caches?" "Old caches is kept." [ $? = 0 ] && { for i in $(cat $diffcachepkg); do - [ -e "$PACKAGE_DIR/$i" ] && echo "rm - $i" + [ -e "$PACKAGE_DIR/$i" ] && rm -v "$PACKAGE_DIR/$i" done for i in $(cat $diffcachesrc); do - [ -e "$SOURCE_DIR/$i" ] && echo "rm - $i" + [ -e "$SOURCE_DIR/$i" ] && rm -v "$SOURCE_DIR/$i" done } fi @@ -1084,7 +1071,7 @@ deplist() { # check currently process package for loop if [ "$CHECK" ]; then - if [ "$(echo $CHECK | tr " " "\n" | grep -x $1)" == "$1" ]; then + if [ "$(echo $CHECK | tr " " "\n" | grep -x $1)" = "$1" ]; then return 0 fi fi @@ -1323,6 +1310,11 @@ for opt in $@; do --nocolor) nocolor;; --repo=*) PORT_REPO="$PORT_REPO ${opt#*=}";; --root=*) ROOT_DIR="${opt#*=}";; + -*) char=${#opt}; count=1 + while [ "$count" != "$char" ]; do + count=$((count+1)) + MAINOPTS="$MAINOPTS -$(echo $opt | cut -c $count)" + done;; *) MAINOPTS="$MAINOPTS $opt";; esac shift