mirror of
https://github.com/containers/podman.git
synced 2025-05-22 01:27:07 +08:00
Support podman-remote help on windows
* Update scipts to produce darwin and windows output * Update batch file to re-direct help requests to browser * Add pandoc filter for markdown to html links Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
@ -491,7 +491,7 @@ special_testing_cgroupv2_task:
|
|||||||
TEST_REMOTE_CLIENT: true
|
TEST_REMOTE_CLIENT: true
|
||||||
TEST_REMOTE_CLIENT: false
|
TEST_REMOTE_CLIENT: false
|
||||||
|
|
||||||
timeout_in: 20m
|
timeout_in: 120m
|
||||||
|
|
||||||
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
|
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
|
||||||
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
|
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
|
||||||
|
14
Makefile
14
Makefile
@ -165,8 +165,13 @@ podman-remote: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on
|
|||||||
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS) remoteclient" -o bin/$@ $(PROJECT)/cmd/podman
|
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS) remoteclient" -o bin/$@ $(PROJECT)/cmd/podman
|
||||||
|
|
||||||
.PHONY: podman.msi
|
.PHONY: podman.msi
|
||||||
podman.msi: podman-remote-windows ## Will always rebuild exe as there is no podman-remote-windows.exe target to verify timestamp
|
podman.msi: podman-remote podman-remote-windows docs ## Will always rebuild exe as there is no podman-remote-windows.exe target to verify timestamp
|
||||||
wixl -D VERSION=$(RELEASE_NUMBER) -o bin/podman-v$(RELEASE_NUMBER).msi contrib/msi/podman.wxs
|
rm -rf bin/windows
|
||||||
|
mkdir -p bin/windows
|
||||||
|
docs/podman-remote.sh windows bin/windows docs
|
||||||
|
find bin/windows -print \
|
||||||
|
|wixl-heat --var var.ManSourceDir --component-group ManFiles --directory-ref INSTALLDIR --prefix bin/windows/ >bin/windows/pages.wsx
|
||||||
|
wixl -D VERSION=$(RELEASE_NUMBER) -D ManSourceDir=bin/windows -o podman-v$(RELEASE_NUMBER).msi contrib/msi/podman.wxs bin/windows/pages.wsx
|
||||||
|
|
||||||
podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
|
podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
|
||||||
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
|
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
|
||||||
@ -316,8 +321,9 @@ $(MANPAGES): %: %.md .gopathok
|
|||||||
|
|
||||||
docs: $(MANPAGES) ## Generate documentation
|
docs: $(MANPAGES) ## Generate documentation
|
||||||
|
|
||||||
install-podman-remote-docs: docs
|
install-podman-remote-docs: podman-remote docs
|
||||||
@(cd docs; ./podman-remote.sh ./remote)
|
rm -rf docs/remote
|
||||||
|
docs/podman-remote.sh darwin docs/remote docs
|
||||||
|
|
||||||
man-page-check:
|
man-page-check:
|
||||||
./hack/man-page-checker
|
./hack/man-page-checker
|
||||||
|
@ -3,6 +3,14 @@ setlocal enableextensions
|
|||||||
|
|
||||||
title Podman
|
title Podman
|
||||||
|
|
||||||
|
if "%1" EQU "" (
|
||||||
|
goto run_help
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" EQU "/?" (
|
||||||
|
goto run_help
|
||||||
|
)
|
||||||
|
|
||||||
:: If remote-host is given on command line -- use it
|
:: If remote-host is given on command line -- use it
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
for %%a in (%*) do (
|
for %%a in (%*) do (
|
||||||
@ -39,5 +47,22 @@ set /p user="Please enter the remote user name: "
|
|||||||
:run_podman
|
:run_podman
|
||||||
endlocal
|
endlocal
|
||||||
podman-remote-windows.exe %*
|
podman-remote-windows.exe %*
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:run_help
|
||||||
|
set run=start "Podman Help" /D "%~dp0" /B
|
||||||
|
|
||||||
|
if not "%3" == "" (
|
||||||
|
%run% "podman-%2-%3.html
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if not "%2" == "" (
|
||||||
|
%run% "podman-%2.html
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
%run% "%podman-remote.html"
|
||||||
|
goto end
|
||||||
|
|
||||||
:End
|
:End
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
<?error VERSION must be defined via command line argument?>
|
<?error VERSION must be defined via command line argument?>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
<?ifndef var.ManSourceDir?>
|
||||||
|
<?define ManSourceDir = "bin/windows" ?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
<Product Name="Podman $(var.VERSION)" Id="*" UpgradeCode="696BAB5D-CA1F-4B05-B123-320F245B8D6D" Version="$(var.VERSION)" Language="1033" Manufacturer="Red Hat Inc.">
|
<Product Name="Podman $(var.VERSION)" Id="*" UpgradeCode="696BAB5D-CA1F-4B05-B123-320F245B8D6D" Version="$(var.VERSION)" Language="1033" Manufacturer="Red Hat Inc.">
|
||||||
|
|
||||||
<Package Id="*" Keywords="Installer" Description="Red Hat's Podman $(var.VERSION) Installer" Comments="Apache 2.0 License" Manufacturer="Red Hat Inc." InstallScope="perMachine" InstallerVersion="100" Compressed="yes"/>
|
<Package Id="*" Keywords="Installer" Description="Red Hat's Podman $(var.VERSION) Installer" Comments="Apache 2.0 License" Manufacturer="Red Hat Inc." InstallScope="perMachine" InstallerVersion="100" Compressed="yes"/>
|
||||||
@ -34,6 +38,7 @@
|
|||||||
<Feature Id="Complete" Level="1">
|
<Feature Id="Complete" Level="1">
|
||||||
<ComponentRef Id="INSTALLDIR_Component"/>
|
<ComponentRef Id="INSTALLDIR_Component"/>
|
||||||
<ComponentRef Id="MainExecutable"/>
|
<ComponentRef Id="MainExecutable"/>
|
||||||
|
<ComponentGroupRef Id="ManFiles"/>
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
<Icon Id="podman.ico" SourceFile="contrib/msi/podman-logo.ico"/>
|
<Icon Id="podman.ico" SourceFile="contrib/msi/podman-logo.ico"/>
|
||||||
|
5
docs/links-to-html.lua
Normal file
5
docs/links-to-html.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# links-to-html.lua
|
||||||
|
function Link(el)
|
||||||
|
el.target = string.gsub(el.target, "%.1.md", ".html")
|
||||||
|
return el
|
||||||
|
end
|
@ -1,11 +1,100 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash -e
|
||||||
|
# Assemble remote man pages for darwin or windows from markdown files
|
||||||
|
|
||||||
BREWDIR=$1
|
PLATFORM=$1 ## windows or darwin
|
||||||
mkdir -p $BREWDIR
|
TARGET=$2 ## where to output files
|
||||||
docs() {
|
SOURCES=${@:3} ## directories to find markdown files
|
||||||
[ -z $1 ] || type="-$1"
|
|
||||||
for i in $(podman-remote $1 --help | sed -n '/^Available Commands:/,/^Flags:/p'| sed -e '1d;$d' -e '/^$/d' | awk '{print $1}'); do install podman$type-$i.1 $BREWDIR 2>/dev/null || install links/podman$type-$i.1 $BREWDIR; done
|
PODMAN=${PODMAN:-bin/podman-remote} ## location overridden for testing
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo >&2 "$0 PLATFORM TARGET SOURCES..."
|
||||||
|
echo >&2 "PLATFORM: Is either darwin or windows."
|
||||||
|
echo >&2 "TARGET: Is the directory where files will be staged."
|
||||||
|
echo >&2 "SOURCES: Are the directories to source markdown files."
|
||||||
}
|
}
|
||||||
docs
|
|
||||||
|
|
||||||
for cmd in 'container image pod volume'; do docs $cmd; done
|
function fail() {
|
||||||
|
echo >&2 -e "$@\n"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
case $PLATFORM in
|
||||||
|
'darwin')
|
||||||
|
EXT=1
|
||||||
|
PUBLISHER=darwin_fn
|
||||||
|
;;
|
||||||
|
'windows')
|
||||||
|
EXT=1.md
|
||||||
|
PUBLISHER=windows_fn
|
||||||
|
;;
|
||||||
|
'-help')
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*) fail '"darwin" and "windows" are currently the only supported platforms.' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ -z $TARGET ]]; then
|
||||||
|
fail 'TARGET directory is required'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $SOURCES ]]; then
|
||||||
|
fail 'At least one SOURCE directory is required'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -x $PODMAN ]]; then
|
||||||
|
fail "$PODMAN does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## darwin_fn copies the markdown page or link to flattened directory
|
||||||
|
function darwin_fn() {
|
||||||
|
local markdown=$1
|
||||||
|
local file=$(basename $markdown)
|
||||||
|
local dir=$(dirname $markdown)
|
||||||
|
|
||||||
|
if [[ -f $dir/links/$file ]]; then
|
||||||
|
markdown=$dir/links/$file
|
||||||
|
fi
|
||||||
|
install $markdown $TARGET
|
||||||
|
}
|
||||||
|
|
||||||
|
## windows_fn converts the markdown page or link to HTML
|
||||||
|
function windows_fn() {
|
||||||
|
local markdown=$1
|
||||||
|
local file=$(basename $markdown)
|
||||||
|
local dir=$(dirname $markdown)
|
||||||
|
|
||||||
|
if [[ ! -f $markdown ]]; then
|
||||||
|
local link=$(sed -e 's?.so man1/\(.*\)?\1?' <$dir/links/${file%.md})
|
||||||
|
markdown=$dir/$link.md
|
||||||
|
fi
|
||||||
|
pandoc --ascii --lua-filter=$dir/links-to-html.lua -o $TARGET/${file%.$EXT}.html $markdown
|
||||||
|
}
|
||||||
|
|
||||||
|
## pub_pages finds and publishes the remote manual pages
|
||||||
|
function pub_pages() {
|
||||||
|
local source=$1
|
||||||
|
local publisher=$2
|
||||||
|
for f in $(ls $source/podman-remote*$EXT); do
|
||||||
|
$publisher $f
|
||||||
|
done
|
||||||
|
|
||||||
|
for c in "container" "image" "pod" "volume" ""; do
|
||||||
|
local cmd=${c:+-$c}
|
||||||
|
for s in $($PODMAN $c --help | sed -n '/^Available Commands:/,/^Flags:/p' | sed -e '1d;$d' -e '/^$/d' | awk '{print $1}'); do
|
||||||
|
$publisher $source/podman$cmd-$s.$EXT
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## walk the SOURCES for markdown sources
|
||||||
|
mkdir -p $TARGET
|
||||||
|
for s in $SOURCES; do
|
||||||
|
if [[ -d $s ]]; then
|
||||||
|
pub_pages $s $PUBLISHER
|
||||||
|
else
|
||||||
|
echo >&2 "Warning: $s does not exist"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
Reference in New Issue
Block a user