Bugzilla – Attachment 12594 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 script doesn't work on non english setups
Bug-8840---ubuntu-pkg-checksh-script-doesnt-work-o.patch (text/plain), 6.23 KB, created by
Tomás Cohen Arazi (tcohen)
on 2012-09-28 16:06:06 UTC
(
hide
)
Description:
Bug 8840 - ubuntu-pkg-check.sh script doesn't work on non english setups
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2012-09-28 16:06:06 UTC
Size:
6.23 KB
patch
obsolete
>From 53522b888c4e7920aa6c8a0a223e8474fb648458 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Thu, 27 Sep 2012 15:03:06 -0300 >Subject: [PATCH] Bug 8840 - ubuntu-pkg-check.sh script doesn't work on non > english setups >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Using dpkg to query for installed packages works in languages other than >english. > >Added some switches to conveniently display the needed apt-get command for >installing Koha's dependencies: > > -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 > >Regards >To+ > >Sponsored-by: Universidad Nacional de Córdoba >--- > install_misc/ubuntu-packages.sh | 153 ++++++++++++++++++++++++++++++++++++++ > install_misc/ubuntu-pkg-check.sh | 27 ------- > 2 files changed, 153 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..244877f >--- /dev/null >+++ b/install_misc/ubuntu-packages.sh >@@ -0,0 +1,153 @@ >+#!/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. >+ >+usage() { >+ local scriptname=$(basename $0) >+ cat <<EOF >+$scriptname >+ >+Query for missing dependencies. Print the install command for them if specified. >+ >+Usage: >+$scriptname -c >+$scriptname -i >+$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 >+ if dpkg -s $package 2>1&> /dev/null ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+ >+# Get the installed package version >+getPackageVersion() { >+ local package=$1 >+ dpkg-query -W $package | cut -f2 >+} >+ >+# Loop over parameters >+while (( "$#" )); do >+ case $1 in >+ -c | --check ) >+ 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 [ ! -e $UBUNTU_PACKAGES_FILE ]; then >+ UBUNTU_PACKAGES_FILE=$DIR/ubuntu.packages >+ >+ echo "# There's no packages file for your distro/release" >+ echo "# WARNING! We strongly recommend an LTS release." >+fi >+ >+echo "# Using the $UBUNTU_PACKAGES_FILE file as source" >+ >+# 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*$'` >+ >+MISSING_PACKAGES="" >+ >+if [ "$CHECK" != "yes" ]; then >+ # Comment for skiping the dots if needed .... >+ echo -n "#" >+fi >+ >+for PACKAGE in $UBUNTU_PACKAGES >+do >+ # Test if the package is installed >+ PACKAGE_INSTALLED="" >+ if packageInstalled $PACKAGE ; then >+ PACKAGE_INSTALLED=1 >+ else >+ # Not installed, accumulate for output >+ MISSING_PACKAGES="$MISSING_PACKAGES $PACKAGE" >+ fi >+ >+ if [ "$CHECK" = "yes" ]; then >+ if [ $PACKAGE_INSTALLED ]; then >+ PACKAGE_VERSION=`getPackageVersion $PACKAGE` >+ else >+ PACKAGE_VERSION="none" >+ fi >+ echo -e "$PACKAGE\t=\t$PACKAGE_VERSION" >+ else >+ # Echo a dot for the impatient >+ echo -n "." >+ fi >+ >+done >+ >+if [ "$CHECK" != "yes" ]; then >+ # newline >+ echo >+fi >+ >+ >+if [ "$INSTALLCMD" = "yes" ]; 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" >+ >+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