From patchwork Fri Jun 17 15:03:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Moreno X-Patchwork-Id: 1644879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i7K/nJQp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LPj43681Gz9sG0 for ; Sat, 18 Jun 2022 01:04:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CE3E641089; Fri, 17 Jun 2022 15:04:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org CE3E641089 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i7K/nJQp X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MzxdC-01zT7U; Fri, 17 Jun 2022 15:04:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id D101E41082; Fri, 17 Jun 2022 15:03:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D101E41082 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B0DF3C0039; Fri, 17 Jun 2022 15:03:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id BE7B3C002D for ; Fri, 17 Jun 2022 15:03:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 926B141084 for ; Fri, 17 Jun 2022 15:03:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 926B141084 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B-4koKnbBfNP for ; Fri, 17 Jun 2022 15:03:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2FE5E40574 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2FE5E40574 for ; Fri, 17 Jun 2022 15:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655478235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TBR/MVgGJOUzpMQHq0h1jJEAH67jrY2TsFtmu9qAIY4=; b=i7K/nJQpNDaLvbGtj0+uoGOv/L8sCR2sPHfZVVV9M8+22LW6ty9o3u8/vC52sZEXv3hSjK vLFv41syJyOksaR8hmk0KUnZsgJpYnqJYruoMqph8b69V6vxojsNBLZWsm/puuzEd3LnYn YTKpqC4n6od2oqnhj2jQx+OrXyJpOiY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-537-Lw-r89DiPB2MAg8PEiWf9Q-1; Fri, 17 Jun 2022 11:03:54 -0400 X-MC-Unique: Lw-r89DiPB2MAg8PEiWf9Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1EB3A80418F for ; Fri, 17 Jun 2022 15:03:54 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.193.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 242492166B26; Fri, 17 Jun 2022 15:03:53 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 17 Jun 2022 17:03:46 +0200 Message-Id: <20220617150346.3041666-1-amorenoz@redhat.com> In-Reply-To: <20220506101039.3657137-1-amorenoz@redhat.com> References: <20220506101039.3657137-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: david.marchand@redhat.com Subject: [ovs-dev] [PATCH v2] ovs-save: add bindir to PATH X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" If openvswitch is not installed in the default system's path ovs-save script will fail to find the tools it requires. Fix this by adding $bindir to the PATH. Refactor common path calculation into ovs-lib. Signed-off-by: Adrian Moreno --- utilities/ovs-ctl.in | 11 +---------- utilities/ovs-kmod-ctl.in | 7 +------ utilities/ovs-lib.in | 21 +++++++++++++++++++++ utilities/ovs-save | 2 ++ 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index e6e07f476..df4770ac2 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -19,16 +19,7 @@ case $0 in esac . "$dir0/ovs-lib" || exit 1 -for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do - case :$PATH: in - *:$dir:*) ;; - *) - case $dir in - $sbindir | $bindir) PATH=$dir:$PATH ;; - *) PATH=$PATH:$dir ;; - esac - esac -done +PATH=$OVS_SBIN_PATH ## ----- ## ## start ## diff --git a/utilities/ovs-kmod-ctl.in b/utilities/ovs-kmod-ctl.in index 19f100964..9804008cf 100644 --- a/utilities/ovs-kmod-ctl.in +++ b/utilities/ovs-kmod-ctl.in @@ -20,12 +20,7 @@ case $0 in esac . "$dir0/ovs-lib" || exit 1 -for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do - case :$PATH: in - *:$dir:*) ;; - *) PATH=$PATH:$dir ;; - esac -done +PATH=$OVS_SBIN_PATH insert_mods () { # Try loading openvswitch kernel module. diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index 13477a6a9..a00c484f6 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -39,6 +39,27 @@ else dbdir='@DBDIR@' fi +OVS_SBIN_PATH=$PATH +OVS_BIN_PATH=$PATH +for dir in "$sbindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do + case :$PATH: in + *:$dir:*) ;; + *) + case $dir in + $bindir) + OVS_BIN_PATH=$dir:$OVS_BIN_PATH + OVS_SBIN_PATH=$dir:$OVS_SBIN_PATH + ;; + $sbindir) + OVS_SBIN_PATH=$dir:$OVS_SBIN_PATH + ;; + *) + OVS_BIN_PATH=$OVS_BIN_PATH:$dir + OVS_SBIN_PATH=$OVS_SBIN_PATH:$dir + esac + esac +done + ovs_ctl_log () { echo "$@" >> "${logdir}/ovs-ctl.log" } diff --git a/utilities/ovs-save b/utilities/ovs-save index a190902f4..1c4810648 100755 --- a/utilities/ovs-save +++ b/utilities/ovs-save @@ -20,6 +20,8 @@ case $0 in esac . "$dir0/ovs-lib" || exit 1 +PATH=$OVS_BIN_PATH + usage() { UTIL=$(basename $0) cat <