Skip to content

Instantly share code, notes, and snippets.

@RomanHargrave
Created December 15, 2020 02:58
Show Gist options
  • Save RomanHargrave/5dc1e483d284189f76549e20de92791a to your computer and use it in GitHub Desktop.
Save RomanHargrave/5dc1e483d284189f76549e20de92791a to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
my $uid = getpwnam($ENV{USER});
my @bind_rw = (
'/proc',
'/sys',
'/dev',
'/dev/shm',
'/dev/pts',
'/home',
'/tmp',
'/var/lib/dbus',
'/mnt/lfs0/roman/Steam',
'/run',
"/run/user/$uid",
);
my @bind_ro = (
);
my @unset_env = (
'LD_PRELOAD',
'PATH'
);
my @binds = ();
push @binds, ('--dev-bind', $_, $_) for @bind_rw;
push @binds, ('--ro-bind', $_, $_) for @bind_ro;
push @cmd, ('--unsetenv', $_) for @unset_env;
my @cmd = (
'bwrap',
'--share-net',
'--bind', '/srv/chroot/steam', '/',
'--proc', '/proc',
@binds,
# add a one-off bind because i need my music in proton apps
'--ro-bind', '/mnt/lfs0/roman/Music', '/home/roman/Music',
'--chdir', $ENV{HOME},
);
push @cmd, ('--', '/bin/bash', @ARGV);
print("command: " . join(' ', @cmd) . "\n");
system(@cmd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment