tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
upstart: remove ancient
Robin Gloster
8 years ago
8dca9bff
df33d1a2
-124
5 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
upstart
check-config.nix
default.nix
upstart-bash-completion
top-level
all-packages.nix
release-small.nix
-43
pkgs/os-specific/linux/upstart/check-config.nix
···
1
1
-
# Useful tool to check syntax of a config file. Upstart needs a dbus
2
2
-
# session, so this script wraps one up and makes the operation not
3
3
-
# require any prior state.
4
4
-
#
5
5
-
# See: http://mwhiteley.com/scripts/2012/12/11/dbus-init-checkconf.html
6
6
-
{stdenv, coreutils, upstart, writeScript, dbus}:
7
7
-
8
8
-
writeScript "upstart-check-config" ''
9
9
-
#!${stdenv.shell}
10
10
-
11
11
-
set -o errexit
12
12
-
set -o nounset
13
13
-
14
14
-
export PATH=${stdenv.lib.makeBinPath [dbus.out upstart coreutils]}:$PATH
15
15
-
16
16
-
if [[ $# -ne 1 ]]
17
17
-
then
18
18
-
echo "Usage: $0 upstart-conf-file" >&2
19
19
-
exit 1
20
20
-
fi
21
21
-
config=$1 && shift
22
22
-
23
23
-
dbus_pid_file=$(mktemp)
24
24
-
exec 4<> $dbus_pid_file
25
25
-
26
26
-
dbus_add_file=$(mktemp)
27
27
-
exec 6<> $dbus_add_file
28
28
-
29
29
-
dbus-daemon --fork --print-pid 4 --print-address 6 --session
30
30
-
31
31
-
function clean {
32
32
-
dbus_pid=$(cat $dbus_pid_file)
33
33
-
if [[ -n $dbus_pid ]]; then
34
34
-
kill $dbus_pid
35
35
-
fi
36
36
-
rm -f $dbus_pid_file $dbus_add_file
37
37
-
}
38
38
-
trap "{ clean; }" EXIT
39
39
-
40
40
-
export DBUS_SESSION_BUS_ADDRESS=$(cat $dbus_add_file)
41
41
-
42
42
-
init-checkconf $config
43
43
-
''
-58
pkgs/os-specific/linux/upstart/default.nix
···
1
1
-
{ stdenv, fetchurl, pkgconfig, dbus, libnih, python, makeWrapper, utillinux
2
2
-
, writeScript }:
3
3
-
4
4
-
let
5
5
-
inherit (stdenv.lib) makeBinPath;
6
6
-
version = "1.5";
7
7
-
8
8
-
upstart = stdenv.mkDerivation rec {
9
9
-
name = "upstart-${version}";
10
10
-
11
11
-
src = fetchurl {
12
12
-
url = "http://upstart.ubuntu.com/download/${version}/${name}.tar.gz";
13
13
-
sha256 = "01w4ab6nlisz5blb0an1sxjkndwikr7sjp0cmz4lg00g3n7gahmx";
14
14
-
};
15
15
-
16
16
-
buildInputs = [ pkgconfig dbus libnih python makeWrapper];
17
17
-
18
18
-
NIX_CFLAGS_COMPILE =
19
19
-
''
20
20
-
-DSHELL="${stdenv.shell}"
21
21
-
-DCONFFILE="/etc/init.conf"
22
22
-
-DCONFDIR="/etc/init"
23
23
-
-DPATH="/no-path"
24
24
-
'';
25
25
-
26
26
-
# The interface version prevents NixOS from switching to an
27
27
-
# incompatible Upstart at runtime. (Switching across reboots is
28
28
-
# fine, of course.) It should be increased whenever Upstart changes
29
29
-
# in a backwards-incompatible way. If the interface version of two
30
30
-
# Upstart builds is the same, then we can switch between them at
31
31
-
# runtime; otherwise we can't and we need to reboot.
32
32
-
passthru.interfaceVersion = 2;
33
33
-
34
34
-
postInstall =
35
35
-
''
36
36
-
t=$out/etc/bash_completion.d
37
37
-
mkdir -p $t
38
38
-
cp ${./upstart-bash-completion} $t/upstart
39
39
-
40
40
-
# Patch some binaries to refer to the correct binary location.
41
41
-
sed -i "s,/sbin/init,$out/bin/init,g" $out/bin/init-checkconf
42
42
-
sed -i "s,initctl,$out/bin/initctl," $out/bin/initctl2dot
43
43
-
44
44
-
# Add some missing executable permissions, and wrap binaries.
45
45
-
chmod +x $out/bin/init-checkconf $out/bin/init-checkconf
46
46
-
wrapProgram $out/bin/init-checkconf \
47
47
-
--prefix PATH : $out/bin:${makeBinPath [utillinux dbus]}
48
48
-
wrapProgram $out/bin/initctl2dot --prefix PATH : $out/bin
49
49
-
'';
50
50
-
51
51
-
meta = {
52
52
-
homepage = http://upstart.ubuntu.com/;
53
53
-
description = "An event-based replacement for the /sbin/init daemon";
54
54
-
platforms = stdenv.lib.platforms.linux;
55
55
-
};
56
56
-
};
57
57
-
58
58
-
in upstart
-18
pkgs/os-specific/linux/upstart/upstart-bash-completion
···
1
1
-
_upstart_comp_list(){
2
2
-
COMPREPLY=()
3
3
-
cur=${COMP_WORDS[COMP_CWORD]}
4
4
-
if [ $COMP_CWORD -eq 1 ]; then
5
5
-
COMPREPLY=( $(compgen -o filenames -W "$@" $cur) )
6
6
-
fi
7
7
-
}
8
8
-
9
9
-
_upstart_complete() { _upstart_comp_list "$(initctl list 2>&1 | grep -E "$1" | cut -f2 -d ' ')"; }
10
10
-
11
11
-
_waiting(){ _upstart_complete "(waiting|instance)"; }
12
12
-
_running(){ _upstart_complete "(running|instance)"; }
13
13
-
_jobs(){ _upstart_comp_list "$(ls -1 /etc/event.d 2> /dev/null)"; }
14
14
-
15
15
-
complete -F _jobs status
16
16
-
complete -F _waiting start
17
17
-
complete -F _running stop
18
18
-
complete -F _running restart
-4
pkgs/top-level/all-packages.nix
···
12754
12754
12755
12755
upower = callPackage ../os-specific/linux/upower { };
12756
12756
12757
12757
-
upstart = callPackage ../os-specific/linux/upstart { };
12758
12758
-
12759
12759
-
upstart-check-config = callPackage ../os-specific/linux/upstart/check-config.nix {};
12760
12760
-
12761
12757
usbguard = libsForQt5.callPackage ../os-specific/linux/usbguard {
12762
12758
libgcrypt = null;
12763
12759
};
-1
pkgs/top-level/release-small.nix
···
159
159
udev = linux;
160
160
unar = linux;
161
161
unzip = all;
162
162
-
upstart = linux;
163
162
usbutils = linux;
164
163
utillinux = linux;
165
164
utillinuxMinimal = linux;