let ipkg fail when a package file to be installed is not found
[openwrt/staging/wigyori.git] / openwrt / package / busybox / patches / 150-udhcp-release.patch
1 diff -Nur busybox-1.1.1/include/usage.h busybox-1.1.1-owrt/include/usage.h
2 --- busybox-1.1.1/include/usage.h 2006-04-01 18:26:21.000000000 +0200
3 +++ busybox-1.1.1-owrt/include/usage.h 2006-04-01 18:27:45.000000000 +0200
4 @@ -3268,6 +3268,7 @@
5 "\t-n,\t--now\tExit with failure if lease cannot be immediately negotiated\n" \
6 "\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \
7 "\t-q,\t--quit\tQuit after obtaining lease\n" \
8 + "\t-R,\t--release\tRelease IP on quit\n" \
9 "\t-r,\t--request=IP\tIP address to request (default: none)\n" \
10 "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
11 "\t-t,\t--retries=NUM\tSend up to NUM request packets\n"\
12 diff -Nur busybox-1.1.1/networking/udhcp/dhcpc.c busybox-1.1.1-owrt/networking/udhcp/dhcpc.c
13 --- busybox-1.1.1/networking/udhcp/dhcpc.c 2006-03-22 22:16:19.000000000 +0100
14 +++ busybox-1.1.1-owrt/networking/udhcp/dhcpc.c 2006-04-01 18:28:19.000000000 +0200
15 @@ -49,6 +49,7 @@
16 .abort_if_no_lease = 0,
17 .foreground = 0,
18 .quit_after_lease = 0,
19 + .release_on_quit = 0,
20 .background_if_no_lease = 0,
21 .interface = "eth0",
22 .pidfile = NULL,
23 @@ -82,6 +83,7 @@
24 " immediately negotiated.\n"
25 " -p, --pidfile=file Store process ID of daemon in file\n"
26 " -q, --quit Quit after obtaining lease\n"
27 +" -R, --release Release IP on quit\n"
28 " -r, --request=IP IP address to request (default: none)\n"
29 " -s, --script=file Run file at dhcp events (default:\n"
30 " " DEFAULT_SCRIPT ")\n"
31 @@ -203,6 +205,7 @@
32 {"now", no_argument, 0, 'n'},
33 {"pidfile", required_argument, 0, 'p'},
34 {"quit", no_argument, 0, 'q'},
35 + {"release", no_argument, 0, 'R'},
36 {"request", required_argument, 0, 'r'},
37 {"script", required_argument, 0, 's'},
38 {"timeout", required_argument, 0, 'T'},
39 @@ -214,7 +217,7 @@
40 /* get options */
41 while (1) {
42 int option_index = 0;
43 - c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qr:s:T:t:v", arg_options, &option_index);
44 + c = getopt_long(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", arg_options, &option_index);
45 if (c == -1) break;
46
47 switch (c) {
48 @@ -284,6 +287,9 @@
49 case 'q':
50 client_config.quit_after_lease = 1;
51 break;
52 + case 'R':
53 + client_config.release_on_quit = 1;
54 + break;
55 case 'r':
56 requested_ip = inet_addr(optarg);
57 break;
58 @@ -527,8 +533,11 @@
59
60 state = BOUND;
61 change_mode(LISTEN_NONE);
62 - if (client_config.quit_after_lease)
63 + if (client_config.quit_after_lease) {
64 + if (client_config.release_on_quit)
65 + perform_release();
66 return 0;
67 + }
68 if (!client_config.foreground)
69 client_background();
70
71 @@ -553,12 +562,13 @@
72 case SIGUSR1:
73 perform_renew();
74 break;
75 - case SIGUSR2:
76 - perform_release();
77 - break;
78 case SIGTERM:
79 LOG(LOG_INFO, "Received SIGTERM");
80 + if (!client_config.release_on_quit)
81 return 0;
82 + case SIGUSR2:
83 + perform_release();
84 + break;
85 }
86 } else if (retval == -1 && errno == EINTR) {
87 /* a signal was caught */
88 diff -Nur busybox-1.1.1/networking/udhcp/dhcpc.h busybox-1.1.1-owrt/networking/udhcp/dhcpc.h
89 --- busybox-1.1.1/networking/udhcp/dhcpc.h 2006-03-22 22:16:19.000000000 +0100
90 +++ busybox-1.1.1-owrt/networking/udhcp/dhcpc.h 2006-04-01 18:27:45.000000000 +0200
91 @@ -19,6 +19,7 @@
92 struct client_config_t {
93 char foreground; /* Do not fork */
94 char quit_after_lease; /* Quit after obtaining lease */
95 + char release_on_quit; /* perform release on quit */
96 char abort_if_no_lease; /* Abort if no lease */
97 char background_if_no_lease; /* Fork to background if no lease */
98 char *interface; /* The name of the interface to use */