Skip to content

Instantly share code, notes, and snippets.

reqlist() {
{
echo "$1"
rpm -q -l --provides "$1"
} | xargs rpm -q --whatrequires | grep -v '^no package requires'
}
reqlist "$@"
@deryni
deryni / index.html
Created May 5, 2017 11:25
cockpit visibility change weirdness
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cockpit Visibility Testing</title>
<script src="../base1/cockpit.js"></script>
<script src="test.js"></script>
</head>
+ make -f main.mk -s
main.mk:3: Using make 3.81
main.mk:7: lst is a:simple
main.mk:11: lst is a b:simple
sub.mk:1: MAKEFLAGS:s
sub.mk:2: MAKEOVERRIDES:
sub.mk:3: -*-command-variables-*-:
sub.mk:7: lst is a b $(tmp):recursive
sub.mk:11: lst is a b $(tmp) $(tmp):recursive
+ make -f main.mk -s lst=foo
@deryni
deryni / powershell.exe
Last active January 2, 2016 03:39
Alright powershell people. Explain this behaviour to me if you would.
PS> help .\test.ps1
test.ps1 [-FirstParam] <Object> [-SecondParam] <Object> [<CommonParameters>]
PS> .\test.ps1 -fi<tab>
# Nothing happens at all.
PS> .\test.ps1
.\test.ps1 : The script 'test.ps1' cannot be run because the following snap-ins that are specified by the "#requires"
statements of the script are missing: VMware.VimAutomation.Core.
...
@deryni
deryni / Makefile
Last active January 1, 2016 11:59
Make snippet to construct a lua command.
# Construct LUA_{,C}PATH strings from input modules.
# $1 - list of modules
# $2 - suffix of valid module names
luapath = $(subst $e ,;,$(filter $(addprefix %.,$2),$(join $(foreach m,$1,$(dir $m)),$(foreach m,$1,?$(suffix $m)))))
# Create -l arguments from the input modules.
# $1 - list of modules
luamodules = $(addprefix -l,$(filter-out ?,$(basename $(notdir $1))))
# Create a dummy loaded package for the given names.
# 'lua_dummymod_$modname' variables will be included as the contents of the
# dummy tables created.
# Find highest known lua version.
#
# It uses pkg-config to do this, but will fail if you have liblua, but
# not the corresponding interpreter/compiler. Let's say you have liblua5.2
# but want to build with liblua5.1 (for which you have the lib, interpreter
# and compiler), you can override by setting LUA_SUFFIX=5.1 when invoking
# make.
#
# If successful, sets the following variables:
# * LUA_SUFFIX (unless already set)
@deryni
deryni / lua-detect-test.mk
Created November 26, 2013 03:37
lua-detect.mk test
LUA_VERSION := $(or $(LUA_VERSION), $(shell \
(pkg-config --exists lua5.2 && echo 5.2) \
|| (pkg-config --exists lua5.1 && echo 5.1) \
|| (pkg-config --exists lua && echo 5.0)))
LUA_VERSION2 := $(or $(LUA_VERSION2), $(shell \
for ver in 5.2 5.1 ""; do\
pkg-config --exists lua$$ver && echo "lua$$ver" && exit;\
done))
@deryni
deryni / gist:7328699
Created November 6, 2013 00:15
'git describe --contains --abbrev=0' doesn't seem to work.
$ git --version
git version 1.8.2.1
$ git lol
* f09682e (HEAD, tag: second-tag, master) add c
* 86db014 add b
* b8c7c3e (tag: initial-tag) initial
$ git describe 86db014
initial-tag-1-g86db014
$ git describe --abbrev=0 86db014
initial-tag
@deryni
deryni / Explanation
Last active December 19, 2015 01:39
Kickstart scripts and related install.log files illustrating CentOS 6 kickstart update problem.
Attempting to kickstart CentOS 6 works correctly. Attempting to include post-DVD updates during kickstart causes lots of scriptlet failures. Can someone tell me why this happens?
Specifically, I know why the failures happen (look at the order of package installation between the two outputs). I also know why rpm doesn't get the transaction order right (the scriplets are missing appropriate requires entries). What I don't understand is why pulling in update packages triggers this issue or why a regular install seems to always work.
I believe there are couple of bugs involved here:
- the sudo package does not contain a Requires(post): /bin/chmod
- the anaconda transaction order solver doesn't take scriplet requires ordering considerations into account beyond one dependency level (so the Requires(pre): /usr/sbin/useradd requirement is fulfilled by the time openssh is installed but anaconda doesn't extend that to ensuring that regular Requires: entries for shadow-utils are ordered correctly)
- that for some r
@deryni
deryni / helpsystem.mk
Created March 31, 2013 22:43
My version of the self-documenting makefile trick. Haven't used this too thoroughly yet so I'm not sure what I think of it but it seems ok so far. It was built for use in a project that doesn't have a meaningful 'all' target. It would probably want the filter changed back to something more like in the original for use in a more normal project.
# Modified version of http://www.cmcrossroads.com/article/self-documenting-makefiles
all:
@printf -- "$(HELPTGT)\n$(ETCTGT)\n" | column -t -s :
HELPTGT := --- Primary Targets ---
helptgt = $1$(eval $(if $(filter-out $(.DEFAULT_GOAL),$(MAKECMDGOALS)),,HELPTGT+=\n$(subst %,<name>,$1): - $2))
ETCTGT := --- Extra Targets ---
etctgt = $1$(eval $(if $(filter-out $(.DEFAULT_GOAL),$(MAKECMDGOALS)),,ETCTGT+=\n$1: - $2))