#include "atoi/a2i.h"
#include "io/fprintf.h"
+#include "getdef.h"
#include "subid.h"
#include "stdlib.h"
if (argc == 0)
usage();
range.owner = argv[0];
- range.start = 0;
- range.count = 65536;
+ range.start = getdef_ulong ("SUB_UID_MIN", 100000UL);
+ range.count = getdef_ulong ("SUB_UID_COUNT", 65536);
if (argc > 1)
str2ul(&range.count, argv[1]);
if (group)
echo -n "New range returned if requested..."
res=$(${build_path}/src/new_subid_range foo 500 -n)
+echo "debug"
+echo "res is $res"
+echo "wanted Subuid range 310000:500"
+echo "end debug"
[ "$res" = "Subuid range 310000:500" ]
[ $(grep -c foo /etc/subuid) -eq 2 ]
echo "OK"
echo -n "Subgids work too..."
res=$(${build_path}/src/new_subid_range -g foo 100000)
-echo "DEBUG: res is ${res}"
-[ "$res" = "Subuid range 501000:100000" ]
+echo "debug"
+echo "res is $res"
+echo "wanted Subuid range 500000:100000"
+echo "end debug"
+[ "$res" = "Subuid range 500000:100000" ]
echo "DEBUG: subgid is:"
cat /etc/subgid
[ $(grep -c foo /etc/subgid) -eq 2 ]
echo "DEBUG: res is ${res}"
echo "DEBUG: subgid is:"
cat /etc/subgid
-[ $(grep -c foo /etc/subgid) -eq 1 ]
+# we had a pre-existing foo line, and added 1, so make sure there are 2 lines
+[ $(grep -c foo /etc/subgid) -eq 2 ]
echo "OK"
log_status "$0" "SUCCESS"