File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # print kernel/system info
4+ uname -srmo
5+ date
6+
37if [ -d " default_scripts" ]; then
48 mv default_scripts/* scripts
59 rm -r default_scripts
@@ -21,7 +25,7 @@ $YTDL --version
2125
2226PID=0
2327
24- # graceful shutdown
28+ # graceful shutdown on kill
2529kill_handler () {
2630 echo " Shutting down..."
2731 kill -s SIGINT -$( ps -o pgid= $PID | grep -o ' [0-9]*' )
@@ -35,7 +39,12 @@ trap 'kill ${!}; kill_handler' SIGTERM # docker stop
3539trap ' kill ${!}; kill_handler' SIGINT # CTRL + C
3640
3741if [[ -v UID ]] || [[ -v GID ]]; then
38- SETPRIV=" setpriv --clear-groups --inh-caps=-all"
42+ # WORKAROUND for `setpriv: libcap-ng is too old for "all" caps`, previously "-all" was used here
43+ # create a list to drop all capabilities supported by current kernel
44+ cap_prefix=" -cap_"
45+ caps=" $cap_prefix $( seq -s " ,$cap_prefix " 0 $( cat /proc/sys/kernel/cap_last_cap) ) "
46+
47+ SETPRIV=" setpriv --clear-groups --inh-caps=$caps "
3948
4049 # set user id
4150 if [[ -v UID ]]; then
You can’t perform that action at this time.
0 commit comments