Bugzilla – Attachment 13200 Details for
Bug 8840
ubuntu-pkg-check.sh fix and extend functionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality
Bug-8840---ubuntu-pkg-checksh-fix-and-extend-funct.patch (text/plain), 7.67 KB, created by
Jared Camins-Esakov
on 2012-11-02 11:49:38 UTC
(
hide
)
Description:
Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-11-02 11:49:38 UTC
Size:
7.67 KB
patch
obsolete
>From 1863cf6a036d66671f34fd456eebdf0781a85088 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Sat, 29 Sep 2012 01:11:55 +0800 >Subject: [PATCH] Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality > >First, reworked it into a newer script with parameters: > ubuntu-packages.sh -r >This will generate output identical to the old script, except >that it is fixed for non-english setups. > ubuntu-packages.sh -h >This adds a brief help, which all scripts should have. > ubuntu-packages.sh -ic >This helps handle a multi-arch problem by printing out a >relevant command for installing missing dependencies. > >Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> >--- > install_misc/ubuntu-packages.sh | 191 ++++++++++++++++++++++++++++++++++++++ > install_misc/ubuntu-pkg-check.sh | 27 ------ > 2 files changed, 191 insertions(+), 27 deletions(-) > create mode 100755 install_misc/ubuntu-packages.sh > delete mode 100755 install_misc/ubuntu-pkg-check.sh > >diff --git a/install_misc/ubuntu-packages.sh b/install_misc/ubuntu-packages.sh >new file mode 100755 >index 0000000..ef2c2c6 >--- /dev/null >+++ b/install_misc/ubuntu-packages.sh >@@ -0,0 +1,191 @@ >+#!/bin/bash >+ >+# Copyright 2012 Universidad Nacional de Cordoba >+# Written by Tomas Cohen Arazi >+# Mark Tompsett >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+# Output simple help >+usage() { >+ local scriptname=$(basename $0) >+ cat <<EOF >+$scriptname >+ >+Query for missing dependencies. Print the install command for them if specified. >+ >+Usage: >+$scriptname -r >+$scriptname -ic >+$scriptname -h >+ >+ -r | --report Report the status of Koha's dependencies >+ -ic | --install-command Display the install command for the missing dependencies >+ -h | --help Display this help message >+EOF >+} >+ >+# Check if the package is installed >+packageInstalled() { >+ local package=$1 >+ local package_status=`dpkg-query --showformat='${Status}' \ >+ -W $package 2> /dev/null` >+ >+ if [ "$package_status" == "install ok installed" ] ; then >+ echo "yes" >+ else >+ echo "no" >+ fi >+} >+ >+# Get the installed package version >+getPackageVersion() { >+ local package=$1 >+ dpkg-query --showformat='${Version}' -W $package >+} >+ >+# A parameter is required. >+if [ "$#" -eq "0" ]; then >+ usage >+ exit 1 >+fi >+ >+# Initialize variables >+CHECK=no >+INSTALLCMD=no >+HELP=no >+ >+# Loop over parameters >+while (( "$#" )); do >+ case $1 in >+ -r | --report ) >+ CHECK=yes >+ ;; >+ -ic | --install-command ) >+ INSTALLCMD=yes >+ ;; >+ -h | --help) >+ HELP=yes >+ ;; >+ * ) >+ usage >+ exit 1 >+ esac >+ shift >+done >+ >+if [ "$HELP" = "yes" ]; then >+ usage >+ exit 0 >+fi >+ >+# Determine what directory this script is in, the packages files >+# should be in the same path. >+DIR=`dirname $0` >+ >+# Determine the Ubuntu release >+UBUNTU_RELEASE=`lsb_release -r | cut -f2 -d' '` >+UBUNTU_PACKAGES_FILE=$DIR/ubuntu.$UBUNTU_RELEASE.packages >+ >+# Check for the release-specific packages file. Default to the general one >+# but warn the user about LTS releases recommended, if they are attempting >+# to do an install command option. >+if [ ! -e $UBUNTU_PACKAGES_FILE ]; then >+ UBUNTU_PACKAGES_FILE=$DIR/ubuntu.packages >+ if [ "$INSTALLCMD" == "yes" ]; then >+ echo "# There's no packages file for your distro/release" >+ echo "# WARNING! We strongly recommend an LTS release." >+ fi >+fi >+ >+# We where asked to print the packages list and current versions (if any) >+UBUNTU_PACKAGES=`awk '{print $1}' $UBUNTU_PACKAGES_FILE | grep -v '^\s*#' | grep -v '^\s*$'` >+ >+# Only output this on an install command option in order to maintain >+# output equivalence to the former script, in the case of reporting >+# only. >+if [ "$INSTALLCMD" == "yes" ]; then >+ >+ # Tell them which file being used to determine the output. >+ echo "# Using the $UBUNTU_PACKAGES_FILE file as source" >+ >+ # Comment for skiping the dots if needed .... >+ if [ "$CHECK" == "no" ]; then >+ echo -n "#" >+ fi >+fi >+ >+# Initialize variable to accumulate missing packages in. >+MISSING_PACKAGES="" >+ >+# Loop used to accumulate the missing packages and display package information if requested to report. >+for PACKAGE in $UBUNTU_PACKAGES; do >+ >+ # If an install command option is running, but not a report option, >+ # There is no need to determine the version number. If it was >+ # This would run even slower! >+ >+ # Test if the package is installed >+ PACKAGE_INSTALLED=`packageInstalled $PACKAGE` >+ >+ # If we are supposed to report... >+ if [ "$CHECK" == "yes" ]; then >+ >+ # Determine the package version if it is installed. >+ if [ "$PACKAGE_INSTALLED" == "yes" ]; then >+ PACKAGE_VERSION=`getPackageVersion $PACKAGE` >+ # otherwise default to 'none'. >+ else >+ PACKAGE_VERSION="none" >+ fi >+ >+ # report the package name and version number. >+ echo "$PACKAGE = $PACKAGE_VERSION" >+ >+ # Otherwise, we'll just echo a dot for the impatient. >+ else >+ echo -n "." >+ fi >+ >+done >+ >+# If we aren't reporting, then the last echo didn't have a newline. >+if [ "$CHECK" != "yes" ]; then >+ echo >+fi >+ >+# If the install command was requested... >+if [ "$INSTALLCMD" == "yes" ]; then >+ >+ # Give them a nicely indented command to copy, if dependencies are missing. >+ if [ "${#MISSING_PACKAGES}" -gt "0" ]; then >+ cat <<EOF >+# Copy and paste the following command to install all Koha's dependencies on your system: >+# Note: this command will run with admin privileges. Make sure your user has sudo rights >+EOF >+ >+ echo -e "\tsudo apt-get install $MISSING_PACKAGES" >+ >+ # Otherwise tell them all is well. >+ else >+ echo -e "# All dependencies installed!" >+ echo -e "# Please confirm the version numbers are sufficient" >+ echo -e "# By running koha_perl_deps.pl -m -u." >+ fi >+ >+fi >+ >+exit 0 >diff --git a/install_misc/ubuntu-pkg-check.sh b/install_misc/ubuntu-pkg-check.sh >deleted file mode 100755 >index 75bec3f..0000000 >--- a/install_misc/ubuntu-pkg-check.sh >+++ /dev/null >@@ -1,27 +0,0 @@ >-#!/bin/sh >- >-# determine what directory this script is in, because the packages files >-# should be there too. >-DIR=`dirname $0` >- >-#determine which vbersion of ubuntu >-VERSION=`lsb_release -r | cut -f2 -d' '` >-UBUNTU_PACKAGES=$DIR/ubuntu.$VERSION.packages >- >-# sanity checks >-if [ ! -e $UBUNTU_PACKAGES ]; then >- echo "WARNING! We strongly recommend an LTS release." >- UBUNTU_PACKAGES=$DIR/ubuntu.packages >-fi >-echo "Using the $UBUNTU_PACKAGES file." >- >-# main >-UBUNTU_PACKAGES_LIST=`awk '{print $1}' $UBUNTU_PACKAGES | grep -v '^\s*#' | grep -v '^\s*$'` >-for F in $UBUNTU_PACKAGES_LIST; do >- UBUNTU_PKG_POLICY=`apt-cache policy $F 2> /dev/null | grep "Installed:"` >- if [ "${#UBUNTU_PKG_POLICY}" -eq "0" ]; then >- UBUNTU_PKG_POLICY="Installed: \(none\)\*" >- fi >- UBUNTU_PKG_VERSION=`echo $UBUNTU_PKG_POLICY | awk '{print $2}'` >- echo "$F = $UBUNTU_PKG_VERSION" >-done >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8840
:
12566
|
12594
|
12599
|
12610
|
12613
|
13200
|
14171
|
14176
|
14177
|
16539
|
16540
|
18096
|
18097