wttech / CQ-Unix-Toolkit

CQ Unix Toolkit
45 stars 24 forks source link

CQ-Unix-Toolkit

CQ Unix Toolkit logo

Table of contents

  1. Introduction
  2. Which for what? (quick description for each tool)
  3. Supported shell environments
  4. Notes on Cygwin compatibility
  5. CQ Compatibilty
  6. Installation
  7. Building an RPM package
  8. Contributors

Introduction

CQ Unix Toolkit is a set of POSIX shell tools that calls curl and other 3rd party commands to perform some different tasks on Adobe CQ platform such as:

Each action is wrapped in separate stand-alone script with additional usage output that allows to perform these tasks easily.

The toolkit aims at use only the basic built-in commands for typical UNIX/POSIX compliant system to avoid installing any 3rd party custom dependencies which is often not possible or prohibited whilst still providing nearly all functionalities for different operating systems and different shell flavours like csh/ksh/bash/dash etc.

Basically almost every tool requires authorized connection to CQ instance which is performed by toolkit using three basic options:

Please note that there is a way to avoid the need to enter -u/-p/-i options each time by executing the following command in the current shell environment:

$ eval $(cqapi -L -u username -p password -i URL)

Please also note that the password is saved in plain text as environmental variable so every process can steal that information so such mode should be used only in development environment or in restricted shell process

The following example should be self descriptive:

$ eval $(cqapi -L -u admin -p admin -i http://localhost:4502)

After you execute this command in your current shell in all cqXXX commands you don't need to specify anything.

Which for what?

Below there is a list of separate tools and short purpose phrase for each one:

Each script can be executed without parameters from your terminal i.e.:

    $ ./cqbld
    Usage: cqbld [OPTION...] package-name
    Build (rebuild) already uploaded package by group id and name in CQ Package
    Manager using instance URL.

    Examples:
      cqbld -u admin pack            # Build package named pack
      cqbld -u admin -g GRP pack     # Build package named pack in group GRP
      cqbld -i http://localhost:5510 # Build package for localhost instance on tcp
            -g com.group stuff       # port 5510 named stuff in group:com.group
            -p secret                # with password provided: secret

    Options:

      -u                    use specified usernamed for connection
      -p                    use provided password for authentication
      -i                    use specified instance URL to connect
      -g                    locate package by additional group ID

so you can find out how to operate and specify required arguments. We are working to be able to help users point correct syntax or provide suggestions in case of incorrect command line is passed.

Supported shell environments

Currently CQ Unix Toolkit supports only some subset of all shell environments, however that list will be improved in the next releases. For each command default shell indicated by /bin/sh symbolic link in your system is used. In case of problems you can prefix command with shell name to use non-default shell i.e. (bash ./cqbld instead of ./cqbld).

Please note that zsh is currently not supported at all! You can get weird errors when using this shell implementation.

Notes on Windows/Cygwin compatibility

In order to use toolkit on cygwin make sure you have marked/installed the following cygwin packages:

If you have any problems, please see cygwin installation screencast.

To test commands just type in command line the following expressions and compare results:

    $ zip -v | head -1
    Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.

    $ curl --version 2>&1 | head -1
    curl 7.34.0 (i686-pc-cygwin) libcurl/7.34.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.26 libssh2/1.4.2

    $ column --version
    column from the package util-linux 2.21.2

Please rememeber that files should have \n endings only. Using git clone they can be changed automatically to \r\n so please use one of the following solutions:

An example of invalid file line endings:

    $ ./cqapi
    ./cqapi: line 16: syntax error `$'\r''
    '/cqapi: line 16: `_usage()

A quick method to fix invalid file line endings problem:

    $ bash -o igncr ./cqapi
    Usage: cqapi [OPTION...]
    ...

To fix this permanently in your code copy just enter in proper directory name:

    $ dos2unix cq*

CQ Compatibilty

Using CQ Unix Toolkit with AEM 6.0 is not recommended.

Installation

Above scripts don't require special installation. If you want these CQ Unix Toolkit to be visible system-wide you can invoke install script provided in repository that creates symbolic link in /usr/local/bin directory or you can change INSTALL_DIR variable in script if you want to something else.

Building an RPM package

Before building place v1.1.0.tar.gz file in SOURCES rpmbuild directory. The correct URL from which file can be obtained is defined in spec file in Source: field.

Contributors

I want to thank every person involved in development of this tools. Personally I want to thank:

Jakub Wadolowski [at] wundermanthompson.com