Misc. fixes

master
Taeyeon Mori 3 years ago
parent d7a566f5f8
commit 89d49d0ce1
  1. 2
      bin/patchdir
  2. 6
      install
  3. 8
      src/overlayns.cpp
  4. 7
      src/steamns.cpp
  5. 5
      zsh/zprofile

@ -351,7 +351,7 @@ def main(argv):
echo "Set PATCHDIR_LOSE_FILES=1 to remove changed files without restoring originals" echo "Set PATCHDIR_LOSE_FILES=1 to remove changed files without restoring originals"
exit 66 exit 66
fi fi
if [ "$1" = "-k" -o -n "$PATCHDIR_KEEP_BACKUP" ]; if [ "${{1-}}" = "-k" -o -n "${{PATCHDIR_KEEP_BACKUP-}}" ]; then
cleanup() {{ cleanup() {{
echo "Keeping $1" echo "Keeping $1"
}} }}

@ -165,11 +165,7 @@ msg "Linking .config files... ($XDG_CONFIG_HOME)"
[[ ${target:t} != ${dest:t} ]] && from=" (${target:t})" [[ ${target:t} != ${dest:t} ]] && from=" (${target:t})"
if [[ ! -d $target ]]; then if [[ ! -d $target ]]; then
color 32 echo " Adding $name$from" color 32 echo " Adding $name$from"
if [[ -L $target ]]; then relink $target $dest
cp -P $target $dest
else
relink $target $dest
fi
else else
if [[ ! -d $dest ]]; then if [[ ! -d $dest ]]; then
color 32 echo " Creating directory $name/$from" color 32 echo " Creating directory $name/$from"

@ -28,6 +28,7 @@ void usage(char const * prog) {
"Spec options:\n" "Spec options:\n"
" -m mnt-spec Add a mount to the namespace\n" " -m mnt-spec Add a mount to the namespace\n"
" -o ovl-spec Add an overlay to the namespace\n" " -o ovl-spec Add an overlay to the namespace\n"
" -N Run in an empty network namespace\n"
"\n" "\n"
"Mount spec:\n" "Mount spec:\n"
" A mount specification takes the following format:\n" " A mount specification takes the following format:\n"
@ -360,9 +361,10 @@ auto parse_overlay_spec(std::string_view s, config &cfg) -> std::list<mount_spec
int main(int argc, char*const* argv) { int main(int argc, char*const* argv) {
config cfg; config cfg;
long clone_flags = CLONE_NEWNS;
// Commandline parsing // Commandline parsing
constexpr auto argspec = "+ho:m:"; constexpr auto argspec = "+ho:m:N";
for (auto opt = ::getopt(argc, argv, argspec); opt != -1; opt = ::getopt(argc, argv, argspec)) { for (auto opt = ::getopt(argc, argv, argspec); opt != -1; opt = ::getopt(argc, argv, argspec)) {
if (opt == 'h' || opt == '?') { if (opt == 'h' || opt == '?') {
@ -388,6 +390,8 @@ int main(int argc, char*const* argv) {
} else { } else {
cfg.recipe.push_back({spec}); cfg.recipe.push_back({spec});
} }
} else if (opt == 'N') {
clone_flags |= CLONE_NEWNET;
} }
} }
cfg.cmdline = &argv[::optind]; cfg.cmdline = &argv[::optind];
@ -413,7 +417,7 @@ int main(int argc, char*const* argv) {
} }
return ::execvp(cfg.cmdline[0], const_cast<char*const*>(cfg.cmdline)); return ::execvp(cfg.cmdline[0], const_cast<char*const*>(cfg.cmdline));
}, 102400, CLONE_NEWNS); }, 102400, clone_flags);
if (ret) if (ret)
return ret; return ret;

@ -140,9 +140,14 @@ namespace nsproc {
while (true) { while (true) {
pid_t w = ::waitpid(-1, NULL, WNOHANG); pid_t w = ::waitpid(-1, NULL, WNOHANG);
if (w == -1) { if (w == 0) {
break;
} else if (w == -1) {
if (errno == ECHILD) if (errno == ECHILD)
break; break;
else
// XXX: Should this abort?
perror("waitpid");
} }
} }
} }

@ -111,6 +111,11 @@ if [ -d "$VITASDK/bin" ]; then
fi fi
#
# GOPATH
#
export GOPATH=$HOME/.local/go
# #
# Paths # Paths
# #

Loading…
Cancel
Save