This commit is contained in:
emmett1
2017-12-18 22:53:04 +08:00
parent a65fdb857a
commit 0ece2bada3
4 changed files with 29 additions and 27 deletions

View File

@@ -199,7 +199,7 @@ buildpackage() {
pushd $SRC
(exec &> >(tee -i $LOG_DIR/$name.log); echo $(date); set -e -x; build)
(exec &> >(tee -i $LOG_DIR/$name.log); echo "$name-$version"; echo $(date); set -e -x; build)
if [ $? != 0 ]; then
msgerr "Build ${color_red}$PKGNAME${color_reset} failed."

View File

@@ -390,9 +390,9 @@ runhooks() {
if [ "$(ls $HOOK_DIR/*.hook 2>/dev/null)" ]; then
for hook in $(ls $HOOK_DIR/*.hook); do
description=$(cat "$hook" | grep ^"# Description" | sed 's/\://' | cut -d ' ' -f 3-)
operation=$(cat "$hook" | grep ^"# Operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# Target" | sed 's/\://' | cut -d ' ' -f 3-)
description=$(cat "$hook" | grep ^"# description" | sed 's/\://' | cut -d ' ' -f 3-)
operation=$(cat "$hook" | grep ^"# operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# target" | sed 's/\://' | cut -d ' ' -f 3-)
if [ -n "$description" ] && [ -n "$operation" ] && [ -n "$target" ]; then
if [ "$(echo $operation | grep -w "$opr" )" ]; then
if [ "$(grep -E $target $INDEX_DIR/$name/.files)" ]; then

View File

@@ -183,9 +183,9 @@ runremovehooks() {
if [ "${#runthishook[@]}" -gt 0 ]; then
for hook in ${runthishook[@]}; do
description=$(cat "$hook" | grep ^"# Description" | sed 's/\://' | cut -d ' ' -f 3-)
operation=$(cat "$hook" | grep ^"# Operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# Target" | sed 's/\://' | cut -d ' ' -f 3-)
description=$(cat "$hook" | grep ^"# description" | sed 's/\://' | cut -d ' ' -f 3-)
operation=$(cat "$hook" | grep ^"# operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# target" | sed 's/\://' | cut -d ' ' -f 3-)
if [ -n "$description" ] && [ -n "$operation" ] && [ -n "$target" ]; then
msg "$description"
. $hook
@@ -193,7 +193,7 @@ runremovehooks() {
exechook
fi
fi
unset description operation target exec
unset description operation target
done
fi
@@ -203,8 +203,8 @@ runpreremovehooks() {
if [ "$(ls $HOOK_DIR/*.hook 2>/dev/null)" ]; then
for hook in $(ls $HOOK_DIR/*.hook); do
operation=$(cat "$hook" | grep ^"# Operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# Target" | sed 's/\://' | cut -d ' ' -f 3-)
operation=$(cat "$hook" | grep ^"# operation" | sed 's/\://' | cut -d ' ' -f 3-)
target=$(cat "$hook" | grep ^"# target" | sed 's/\://' | cut -d ' ' -f 3-)
if [ "$(echo $operation | grep -w "remove" )" ]; then
if [ "$(grep -E $target $INDEX_DIR/$1/.files)" ]; then
runthishook+=($hook)
@@ -265,7 +265,7 @@ main() {
### CHECK DIRECTORY ###
checkdirexist "$INDEX_DIR" "$BACKUP_DIR" "$REJECTED_DIR"
checkdirwrite "$INDEX_DIR" "$BACKUP_DIR" "$REJECTED_DIR"
checkdirread "$INDEX_DIR" "$BACKUP_DIR" "$REJECTED_DIR"
checkdirread "$INDEX_DIR" "$BACKUP_DIR" "$REJECTED_DIR"
### PACKAGE NAME ###
if [ -z $RMNAME ]; then

34
scratch
View File

@@ -79,18 +79,16 @@ searchpkg() {
for port in ${PORT_REPO[@]}; do
if [ -d $port ]; then
OUTPUT=()
for list in $(ls $port); do
if [ -f $port/$list/$BUILD_SCRIPT ]; then
if [ "$(cat $port/$list/$BUILD_SCRIPT | grep ^'# description' | tr -d ':' | cut -d ' ' -f 3- | grep -i $SEARCH_PKG)" ] || [ "$(echo $list | grep -i $SEARCH_PKG)" ]; then
OUTPUT+=($list)
fi
fi
done
for out in ${OUTPUT[@]}; do
if [ -f $port/$out/$BUILD_SCRIPT ]; then
pushd $port/$out
getpkginfo
popd
pushd $port
OUTPUT=$(grep -R "# description" | grep -i "$SEARCH_PKG" | cut -d '/' -f1)
popd
if [ "$OUTPUT" ]; then
found=yes
for out in ${OUTPUT[@]}; do
if [ -f $port/$out/$BUILD_SCRIPT ]; then
pushd $port/$out
getpkginfo
popd
if [ ! -z "$name" ] && [ ! -z "$version" ] && [ ! -z "$release" ]; then
portname=$(basename $port)
search_result="${color_purple}($portname)${color_reset} ${color_gray}$name${color_reset} ${color_cyan}$version-$release${color_reset}"
@@ -100,7 +98,7 @@ searchpkg() {
msg3 "$search_result ${color_green}[installed]${color_reset}"
msg4 "$description"
else
msg3 "$search_result ${color_yellow}[outdated] $iversion-$irelease${color_reset}"
msg3 "$search_result ${color_yellow}[installed $iversion-$irelease]${color_reset}"
msg4 "$description"
fi
else
@@ -109,17 +107,21 @@ searchpkg() {
fi
unset description
fi
fi
done
fi
done
fi
fi
done
if [ "$found" != "yes" ]; then
msg "No matching package found."
fi
}
checkowner() {
for installed in $(ls $INDEX_DIR); do
for output in $(cat $INDEX_DIR/$installed/.files | grep $OWNER_FILE_NAME); do
msg "${color_cyan}$installed${color_reset} => ${color_purple}$output${color_reset}"
echo -e "${color_cyan}$installed${color_reset} => ${color_purple}$output${color_reset}"
done
done