Shell script to ls and execute command on ls result - linux

I have a list of folders inside a folder in ubuntu.
ie.
Under /mnt/source/customcode/files/brands/
root#a919794ec280:/mnt/source/customcode/files/brands# ls -la
total 236
drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 .
drwxrwxrwx 8 1002 1003 4096 Dec 27 22:45 ..
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 aem
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 apple
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 cool
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 doll
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 ent
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 f1
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 google
drwxrwxrwx 3 1002 root 4096 Jan 3 09:22 h1
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 iq
drwxr-xr-x 3 1002 root 4096 Jan 3 09:22 king
drwxrwxrwx 3 root root 4096 Jan 3 09:22 link
drwxrwxrwx 3 1002 root 155648 Jan 3 09:22 nobrand
drwxrwxr-x 3 1002 1003 12288 Jan 3 09:22 pepperfry
drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 pepsi
drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 rock
drwxrwxrwx 2 1002 root 4096 Jan 3 09:22 star9
drwxrwxr-x 2 1002 1003 4096 Jan 3 09:22 vicks
----- 100+ -----
Like above, I have folders like "a1", "cola", "link" and etc. (more then 100 folders)
In side those each folders there will be a folder named "data_aug" and "data_aug" folder do contain files inside.
root#a919794ec280:/mnt/source/customcode/files/brands/apple# ls -la
total 1988
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 .
drwxrwxrwx 19 1002 root 4096 Jan 3 09:26 ..
-rw-r--r-- 1 1002 1003 17465 Dec 29 23:28 0DPA0C3.jpg
-rw-r--r-- 1 1002 1003 3836 Dec 31 00:55 130418131111-apple-store-santa-monica.jpg
-rw-r--r-- 1 1002 1003 48616 Dec 31 00:52 15146774227434507677123475441338.jpg
-rw-r--r-- 1 1002 1003 9107 Dec 31 00:52 15146774615326659565665852728294.jpg
-rw-r--r-- 1 1002 1003 28005 Dec 29 23:28 3D-Apple-Logo-Wallpapers.jpg
-rw-r--r-- 1 1002 1003 75855 Dec 29 23:28 3D-Apple-Logo.jpg
-rw-r--r-- 1 1002 1003 27403 Dec 29 23:28 3d_apple_logo___wallpaper_by_techflashdesigns-d4fbc7p.jpg
-rw-r--r-- 1 1002 1003 38420 Dec 29 23:28 AX62GjL.jpg
-rw-r--r-- 1 1002 1003 6025 Dec 29 23:28 Apple-Logo-2016 (1).jpg
-rw-r--r-- 1 1002 1003 929419 Dec 29 23:28 Apple-Logo-Png-Download.png
-rw-r--r-- 1 1002 1003 35742 Dec 29 23:28 apple-logo-2016.jpg
-rw-r--r-- 1 1002 1003 15301 Dec 29 23:28 apple-logo-3d-model-max-obj-fbx-3dm-ige-igs-iges.jpg
-rw-r--r-- 1 1002 1003 42514 Dec 29 23:28 apple-logo-clipart-2.jpeg
-rw-r--r-- 1 1002 1003 152183 Dec 29 23:28 apple-logo-clouds.jpg
-rw-r--r-- 1 1002 1003 6117 Dec 31 00:55 apple1.jpg
-rw-r--r-- 1 1002 1003 349787 Dec 29 23:28 apple_ipad_logo.png
-rw-r--r-- 1 1002 1003 54167 Dec 29 23:28 b5c4d6c9-3.jpg
drwxr-xr-x 2 root root 4096 Jan 3 09:22 data_aug
-rw-r--r-- 1 1002 1003 32918 Dec 29 23:28 large.JPG
-rw-r--r-- 1 1002 1003 48972 Dec 29 23:28 medium.jpg
-rw-r--r-- 1 1002 1003 3609 Dec 29 23:28 th (1).jpeg
-rw-r--r-- 1 1002 1003 30392 Dec 29 23:28 th (2).jpeg
-rw-r--r-- 1 1002 1003 3222 Dec 29 23:28 th.jpeg
-rw-r--r-- 1 1002 1003 22544 Dec 29 23:28 u5TAcBk.jpg
root#a919794ec280:/mnt/source/customcode/files/brands/apple/data_aug# ls -la
total 4356
drwxr-xr-x 2 root root 12288 Jan 3 09:41 .
drwxrwxr-x 3 1002 1003 4096 Jan 3 09:22 ..
-rw-r--r-- 1 root root 10450 Jan 3 09:40 apple_0_1.jpeg
-rw-r--r-- 1 root root 5599 Jan 3 09:40 apple_0_1019.jpeg
-rw-r--r-- 1 root root 3225 Jan 3 09:40 apple_0_1075.jpeg
-rw-r--r-- 1 root root 10283 Jan 3 09:40 apple_0_1100.jpeg
-rw-r--r-- 1 root root 13923 Jan 3 09:41 apple_0_1119.jpeg
Now...
I need a script to be placed in "/mnt/source/customcode/"
Want to run the script from "/mnt/source/customcode/" as my script dependent files are can only be executed from "/mnt/source/customcode/"to achieve bellow.
Delete the folder "data_aug" and the data inside "data_aug"
recursively from all the 100 folders.
Then from the "/mnt/source/customcode/" location I should execute a
special script which, it will refer those 100 folders. like example
below.
Code...
python -m scripts.augmentation_keras --image_dir=files/brands/apple --target_dir=files/brands/apple/data_aug --save_prefix=apple
python -m scripts.augmentation_keras --image_dir=files/brands/a1 --target_dir=files/brands/a1/data_aug --save_prefix=a1
like above for all the 100 folders. The number of folders 100 will grow more in future.
How can I do it dynamically instead of writing simple script with hundreds of lines (static deletion and execution)!
Thanks.

Probably something like this:
for d in /home/user/data/*
do
rm -rf $d/content/*
python -m scripts.augmentation_keras --image_dir=$d --
target_dir=$d/content --save_prefix=$(basename $d)
done

Related

Hidden Files Not Being Copied On Mac with cp -r

Very very weird issue. I have a project that has hidden files on Mac OS 12.2.1, I am try to copy over. For example:
drwxr-xr-x 16 john staff 512 Jun 25 10:35 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r--# 1 john staff 6148 Jun 5 13:52 .DS_Store
drwxr-xr-x 14 john staff 448 Jun 26 20:29 .git
-rw-r--r-- 1 john staff 310 Jun 4 09:52 .gitignore
-rw-r--r-- 1 john staff 368 Jun 4 10:15 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 20 15:29 README.md
drwxr-xr-x 8 john staff 256 Jun 24 16:49 build
-rw-r--r-- 1 john staff 217 Jun 4 10:16 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 25 14:31 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 25 14:31 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 25 14:31 package.json
-rw-r--r-- 1 john staff 82 Jun 4 10:30 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 5 14:00 public
drwxr-xr-x 18 john staff 576 Jun 20 13:42 src
-rw-r--r-- 1 john staff 2836 Jun 5 02:36 tailwind.config.js
Now I run the following command
sudo cp -R * ../otherfolder
And I've also tried a variation
cp -r * ../otherfolder
And the following is there:
drwxr-xr-x 13 john staff 416 Jun 27 07:54 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r-- 1 john staff 368 Jun 27 07:54 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 27 07:54 README.md
drwxr-xr-x 8 john staff 256 Jun 27 07:54 build
-rw-r--r-- 1 john staff 217 Jun 27 07:54 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 27 07:54 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 27 07:54 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 27 07:54 package.json
-rw-r--r-- 1 john staff 82 Jun 27 07:54 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 27 07:54 public
drwxr-xr-x 18 john staff 576 Jun 27 07:54 src
-rw-r--r-- 1 john staff 2836 Jun 27 07:54 tailwind.config.js
None of the invisible files with a period in front have NOT been copied over. Any ideas?
cp -rpv . /path/to/other/folder/

bash: poetry: command not found

Goal: Get Poetry working in my Anaconda3 venvs.
I'm using Anaconda3, via. Git Bash in PyCharm.
I installed Poetry using:
conda install -c conda-forge poetry
Location:
C:\Users\dabell\Anaconda3\Lib\site-packages\poetry
C:\Users\dabell\Anaconda3\Scripts\poetry.exe
$ ls -alrth
total 376K
-rw-r--r-- 3 HDS+dabell 4096 81 Mar 31 15:37 __init__.py
-rw-r--r-- 3 HDS+dabell 4096 1.4K Apr 20 06:53 poetry.py
-rw-r--r-- 3 HDS+dabell 4096 506 Apr 20 06:53 locations.py
-rw-r--r-- 3 HDS+dabell 4096 5.3K Apr 20 06:53 factory.py
-rw-r--r-- 3 HDS+dabell 4096 99 Apr 20 06:53 exceptions.py
-rw-r--r-- 3 HDS+dabell 4096 23 Apr 20 06:53 __version__.py
-rw-r--r-- 3 HDS+dabell 4096 92 Apr 20 06:53 __main__.py
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 core/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 __pycache__/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 _vendor/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 config/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 console/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 inspection/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 installation/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 io/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 json/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 layouts/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 masonry/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 mixology/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 packages/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ./
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 publishing/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 puzzle/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 repositories/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 utils/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 version/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ../
However, in (base) or in any (<venv>) - when I run:
$ poetry install pandas
bash: poetry: command not found
python -m poetry install pandas:
C:\Users\dabell\Anaconda3\envs\sdg\python.exe: No module named poetry
I added it to .bashrc, and still get the above error:
$ export PATH="$HOME/.poetry/bin:$PATH"
or
$ export PATH=C:/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
$ poetry install pandas
bash: poetry: command not found
$ winpty poetry install pandas
winpty: error: cannot start 'poetry': Not found in PATH
$ $HOME/.poetry/bin
bash: /c/Users/dabell/.poetry/bin: No such file or directory
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ export PATH=/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ poetry install pandas
bash: poetry: command not found
$ echo $PATH
/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:/c/Users/dabell/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/dabell/bin:/c/Users/dabell/Anaconda3/envs/sdg:/c/Users/dabell/Anaconda3/e
nvs/sdg/Library/mingw-w64/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/usr/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/bin:/c/Users/dabell/Anaconda3/envs/sdg/Scripts:/c/Users/dabell/Anaconda3/envs/sdg/bin:/c/User
s/dabell/Anaconda3/condabin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/Windo
wsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/gs/gs9.56.1/bin:/c/Users/dabell/AppData/Local/Programs/Python/Python310:/usr/bin/vendor_perl:/usr/bin/core_perl

linux find files by created in last X minutes + sort does not return expected list

I have a folder with many jpg files, where each file name presents the creation time in the form of: "20220204T160311.746....jpg" ("..." represent additional data).
I'm trying to get all files created on the last X minutes. There are tons of results for such query if one asks Google, nevertheless, I'm getting weird results when trying the following:
find . -cmin -50 \( ! -iname "*.csv" ! -iname ".*" \) -ls | sort -n
the results do not start ok ("now" is 16:26):
14466561 2636 -rw-r--r-- 1 root root 2695349 Feb 4 16:03 ./20220204T160348.526-cam4-791-AREASbw-32358.jpg
14466569 2208 -rw-r--r-- 1 root root 2257356 Feb 4 16:03 ./20220204T160354.069-cam4-614.jpg
14466571 1044 -rw-r--r-- 1 root root 1068758 Feb 4 16:03 ./20220204T160354.069-cam4-614__chng_182.jpg
14466579 2208 -rw-r--r-- 1 root root 2258697 Feb 4 16:03 ./20220204T160359.296-cam4-352.jpg
14466581 1048 -rw-r--r-- 1 root root 1070111 Feb 4 16:03 ./20220204T160359.296-cam4-352__chng_175.jpg
14466589 2216 -rw-r--r-- 1 root root 2268675 Feb 4 16:04 ./20220204T160404.682-cam4-179.jpg
14466591 1048 -rw-r--r-- 1 root root 1070053 Feb 4 16:04 ./20220204T160404.682-cam4-179__chng_273.jpg
14466597 2204 -rw-r--r-- 1 root root 2253706 Feb 4 16:04 ./20220204T160409.957-cam4-571.jpg
14466599 1048 -rw-r--r-- 1 root root 1070335 Feb 4 16:04 ./20220204T160409.957-cam4-571__chng_154.jpg
14466600 1044 -rw-r--r-- 1 root root 1068675 Feb 4 16:04 ./20220204T160409.957-cam4-571__chng_309.jpg
14466601 2652 -rw-r--r-- 1 root root 2712638 Feb 4 16:04 ./20220204T160409.957-cam4-571-AREASbw-31696.jpg
14466610 2208 -rw-r--r-- 1 root root 2259408 Feb 4 16:04 ./20220204T160415.421-cam4-959.jpg
14466611 1048 -rw-r--r-- 1 root root 1070365 Feb 4 16:04 ./20220204T160415.421-cam4-959__chng_272.jpg
14466620 2212 -rw-r--r-- 1 root root 2264606 Feb 4 16:04 ./20220204T160420.666-cam4-742.jpg
14466621 1048 -rw-r--r-- 1 root root 1070276 Feb 4 16:04 ./20220204T160420.666-cam4-742__chng_173.jpg
and when I continue to scroll up, it arrives to a part where the files are wrongly sorted (like what supposed to be the start of the list):
14457644 2240 -rw-r--r-- 1 root root 2293209 Feb 4 16:26 ./20220204T162633.985-cam4-188.jpg
14457645 1056 -rw-r--r-- 1 root root 1080805 Feb 4 16:26 ./20220204T162633.985-cam4-188__chng_171.jpg
14457658 2236 -rw-r--r-- 1 root root 2286664 Feb 4 16:26 ./20220204T162639.299-cam4-801.jpg
14457659 1056 -rw-r--r-- 1 root root 1080042 Feb 4 16:26 ./20220204T162639.299-cam4-801__chng_158.jpg
14462048 2200 -rw-r--r-- 1 root root 2252735 Feb 4 15:49 ./20220204T154927.284-cam4-095.jpg
14462049 1044 -rw-r--r-- 1 root root 1065249 Feb 4 15:49 ./20220204T154927.284-cam4-095__chng_134.jpg
14462088 2204 -rw-r--r-- 1 root root 2255657 Feb 4 15:49 ./20220204T154932.490-cam4-571.jpg
14462089 1044 -rw-r--r-- 1 root root 1066449 Feb 4 15:49 ./20220204T154932.490-cam4-571__chng_228.jpg
14462118 2204 -rw-r--r-- 1 root root 2254481 Feb 4 15:49 ./20220204T154937.767-cam4-237.jpg
14462127 1044 -rw-r--r-- 1 root root 1066700 Feb 4 15:49 ./20220204T154937.767-cam4-237__chng_79.jpg
How come in the middle it goes back from 15:49 to 16:26?
It happens on every query I'm running, unless it is on a short term like 10 min.
By default sort uses the first column. Use -k to specify column number to sort by.
find . -cmin -50 \( ! -iname "*.csv" ! -iname ".*" \) -ls | sort -n -k 7

How to get the vendor and product ID of a usb device from /sys/bus/devices/usb/devices

I have a WiFi adapter plugged into my computer, I can find it's ID numbers by looking through the output of lsusb.
Bus 005 Device 009: ID 1737:0071 Linksys WUSB600N v1 Dual-Band Wireless-N Network Adapter [Ralink RT2870]
This is the only wiFi adapter I have plugged in currently, so this obviously is it. I searched around in /sys/bus/usb/devices/ until I found this path on my machine
# ls -l /sys/bus/usb/devices/5-3.1:1.0/
total 0
-rw-r--r-- 1 root root 4096 Dec 28 18:11 authorized
-r--r--r-- 1 root root 4096 Dec 28 18:11 bAlternateSetting
-r--r--r-- 1 root root 4096 Dec 28 18:06 bInterfaceClass
-r--r--r-- 1 root root 4096 Dec 28 18:06 bInterfaceNumber
-r--r--r-- 1 root root 4096 Dec 28 18:06 bInterfaceProtocol
-r--r--r-- 1 root root 4096 Dec 28 18:06 bInterfaceSubClass
-r--r--r-- 1 root root 4096 Dec 28 18:11 bNumEndpoints
lrwxrwxrwx 1 root root 0 Dec 28 18:06 driver -> ../../../../../../../../bus/usb/drivers/rt2800usb
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_01
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_02
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_03
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_04
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_05
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_06
drwxr-xr-x 3 root root 0 Dec 28 18:11 ep_81
drwxr-xr-x 3 root root 0 Dec 28 18:06 ieee80211
drwxr-xr-x 5 root root 0 Dec 28 18:06 leds
-r--r--r-- 1 root root 4096 Dec 28 18:11 modalias
drwxr-xr-x 3 root root 0 Dec 28 18:06 net
drwxr-xr-x 2 root root 0 Dec 28 18:11 power
lrwxrwxrwx 1 root root 0 Dec 28 18:06 subsystem -> ../../../../../../../../bus/usb
-r--r--r-- 1 root root 4096 Dec 28 18:11 supports_autosuspend
-rw-r--r-- 1 root root 4096 Dec 28 18:06 uevent
By looking at the driver symbolic link I see this is using the rt2800usb driver. So this has to be the correct entry for my WiFi adapter. But identifying based off kernel driver name is inexact and I would prefer not do it that way. Is there a file under /sys/bus/usb/devices/5-3.1:1.0/ that can tell me the vendor ID and the product ID of the entry I am looking at?

Unexpected bash readable test result with GitHub Actions

MWE
I have a GitHub Actions workflow that recently stopped working without me making changes. The error:
==> ERROR: /etc/makepkg.conf not found.
Aborting...
This is from running # sudo -Eu builder makepkg --printsrcinfo.
Source
Logs
The order of the logs seem to be wrong but it is correct in an earlier log (possibly due to ls -l having a large output).
The source of this error seems to be libmakepkg/util/config.sh.in:
# Source the config file; fail if it is not found
if [[ -r $MAKEPKG_CONF ]]; then
source_safe "$MAKEPKG_CONF"
else
error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
plainerr "$(gettext "Aborting...")"
exit $E_CONFIG_ERROR
fi
I added the following to my entrypoint script:
echo "Writing SRCINFO..."
# Debug
echo "---"
ls -l /
echo "---"
ls -l /etc
echo "---"
sudo -Eu builder cat /etc/makepkg.conf
echo "---"
sudo -Eu builder /bin/bash -c "[[ -r "/etc/makepkg.conf" ]] && echo 1 || echo 0"
echo "---"
sudo -Eu builder makepkg --printsrcinfo > .SRCINFO
The builder user is created in build.sh:
useradd builder -m
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
I got:
Setting permissions...
Writing SRCINFO...
---
total 52
lrwxrwxrwx 1 root root 7 Feb 1 19:19 bin -> usr/bin
drwxr-xr-x 2 root root 4096 Jan 19 01:32 boot
drwxr-xr-x 5 root root 340 Feb 7 11:58 dev
-rwxr-xr-x 1 root root 836 Feb 7 11:57 entrypoint.sh
drwxr-xr-x 1 root root 4096 Feb 7 11:58 etc
drwxr-xr-x 6 root root 4096 Feb 7 11:58 github
drwxr-xr-x 1 root root 4096 Feb 7 11:57 home
lrwxrwxrwx 1 root root 7 Feb 1 19:19 lib -> usr/lib
lrwxrwxrwx 1 root root 7 Feb 1 19:19 lib64 -> usr/lib
drwxr-xr-x 2 root root 4096 Jan 19 01:32 mnt
drwxr-xr-x 2 root root 4096 Jan 19 01:32 opt
dr-xr-xr-x 159 root root 0 Feb 7 11:58 proc
drwxr-x--- 2 root root 4096 Jan 19 01:32 root
drwxr-xr-x 1 root root 4096 Feb 7 11:58 run
lrwxrwxrwx 1 root root 7 Feb 1 19:19 sbin -> usr/bin
drwxr-xr-x 4 root root 4096 Feb 1 19:19 srv
dr-xr-xr-x 12 root root 0 Feb 7 11:58 sys
drwxrwxrwt 2 root root 4096 Jan 19 01:32 tmp
drwxr-xr-x 1 root root 4096 Feb 7 11:57 usr
drwxr-xr-x 1 root root 4096 Feb 1 19:19 var
---
total 640
-rw-r--r-- 1 root root 0 Jan 19 01:32 arch-release
drwxr-xr-x 3 root root 4096 Feb 1 19:19 audit
-rw-r--r-- 1 root root 28 Dec 20 18:44 bash.bash_logout
-rw-r--r-- 1 root root 618 Dec 20 18:44 bash.bashrc
-rw-r--r-- 1 root root 447 Dec 2 16:02 bindresvport.blacklist
drwxr-xr-x 2 root root 4096 Dec 16 14:38 binfmt.d
drwxr-xr-x 4 root root 4096 Feb 1 19:19 ca-certificates
-rw------- 1 root root 722 Jan 19 01:32 crypttab
drwxr-xr-x 2 root root 4096 Feb 1 19:19 default
drwxr-xr-x 2 root root 4096 Jan 7 19:51 depmod.d
-rw-r--r-- 1 root root 685 Jan 31 20:31 e2scrub.conf
-rw-r--r-- 1 root root 97 Jan 13 22:50 environment
-rw-r--r-- 1 root root 1362 Jan 20 21:31 ethertypes
-rw-r--r-- 1 root root 126 Jan 19 01:32 fstab
-rw-r--r-- 1 root root 2584 Feb 6 00:09 gai.conf
-rw-r--r-- 1 root root 626 Feb 7 11:57 group
-rw-r--r-- 1 root root 610 Jan 31 00:20 group-
-rw------- 1 root root 558 Feb 7 11:57 gshadow
-rw------- 1 root root 546 Jan 31 00:20 gshadow-
-rw-r--r-- 1 root root 73 Jan 19 01:32 host.conf
-rw-r--r-- 1 root root 13 Feb 7 11:58 hostname
-rw-r--r-- 1 root root 174 Feb 7 11:58 hosts
-rw-r--r-- 1 root root 714 Dec 8 17:48 inputrc
drwxr-xr-x 2 root root 4096 Feb 1 19:19 iproute2
drwxr-xr-x 2 root root 4096 Feb 1 19:19 iptables
-rw-r--r-- 1 root root 20 Jan 19 01:32 issue
drwxr-xr-x 3 root root 4096 Feb 1 19:19 kernel
drwxr-xr-x 2 root root 4096 Jul 7 2020 keyutils
-rw-r--r-- 1 root root 369 Jan 14 00:32 krb5.conf
-rw-r--r-- 1 root root 18096 Feb 7 11:57 ld.so.cache
-rw-r--r-- 1 root root 117 Jan 19 01:32 ld.so.conf
drwxr-xr-x 1 root root 4096 Feb 7 11:57 ld.so.conf.d
-rw-r----- 1 root root 191 Jan 13 22:33 libaudit.conf
drwxr-xr-x 2 root root 4096 Feb 1 19:19 libnl
-rw-r--r-- 1 root root 17 Jan 31 00:19 locale.conf
-rw-r--r-- 1 root root 18 Jan 31 00:19 locale.gen
-rw-r--r-- 1 root root 9984 Feb 6 00:09 locale.gen.pacnew
-rw-r--r-- 1 root root 5645 Sep 7 13:42 login.defs
-rw-r--r-- 1 root root 5792 Jul 1 2020 makepkg.conf
-rw-r--r-- 1 root root 812 Jan 31 20:31 mke2fs.conf
drwxr-xr-x 2 root root 4096 Jan 7 19:51 modprobe.d
drwxr-xr-x 2 root root 4096 Dec 16 14:38 modules-load.d
-rw-r--r-- 1 root root 0 Jan 19 01:32 motd
lrwxrwxrwx 1 root root 12 Feb 7 11:58 mtab -> /proc/mounts
-rw-r--r-- 1 root root 767 Dec 2 16:02 netconfig
-rw-r--r-- 1 root root 2717 Feb 6 00:09 nscd.conf
-rw-r--r-- 1 root root 328 Jan 19 01:32 nsswitch.conf
drwxr-xr-x 1 root root 4096 Feb 7 11:57 openldap
lrwxrwxrwx 1 root root 19 Feb 1 19:19 os-release -> /usr/lib/os-release
-rw-r--r-- 1 root root 3264 Feb 7 11:57 pacman.conf
-rw-r--r-- 1 root root 2883 Jul 1 2020 pacman.conf.pacnew
drwxr-xr-x 1 root root 4096 Feb 7 11:57 pacman.d
drwxr-xr-x 1 root root 4096 Feb 7 11:57 pam.d
-rw-r--r-- 1 root root 744 Feb 7 11:57 passwd
-rw-r--r-- 1 root root 699 Jan 31 00:20 passwd-
drwxr-xr-x 2 root root 4096 Feb 1 19:19 pkcs11
-rw-r--r-- 1 root root 1020 Jan 19 01:32 profile
drwxr-xr-x 1 root root 4096 Feb 7 11:57 profile.d
-rw-r--r-- 1 root root 3171 Jan 3 17:14 protocols
-rw-r--r-- 1 root root 1814 Jul 7 2020 request-key.conf
drwxr-xr-x 2 root root 4096 Jul 7 2020 request-key.d
-rw-r--r-- 1 root root 649 Feb 7 11:58 resolv.conf
-rw-r--r-- 1 root root 1634 Feb 6 00:09 rpc
-rw-r--r-- 1 root root 139 Jan 19 01:32 securetty
drwxr-xr-x 2 root root 4096 Feb 1 19:19 security
-rw-r--r-- 1 root root 297708 Jan 3 17:14 services
-rw------- 1 root root 375 Feb 7 11:57 shadow
-rw------- 1 root root 346 Jan 31 00:20 shadow-
-rw-r--r-- 1 root root 83 Jan 19 01:32 shells
drwxr-xr-x 2 root root 4096 Feb 1 19:19 skel
drwxr-xr-x 5 root root 4096 Feb 1 19:19 ssl
-rw-r--r-- 1 root root 3975 Jan 26 18:34 sudo.conf
-r--r----- 1 root root 3160 Feb 7 11:57 sudoers
drwxr-x--- 2 root root 4096 Jan 26 18:34 sudoers.d
-rw-r--r-- 1 root root 6169 Jan 26 18:34 sudo_logsrvd.conf
drwxr-xr-x 2 root root 4096 Dec 16 14:38 sysctl.d
drwxr-xr-x 1 root root 4096 Feb 7 11:57 systemd
drwxr-xr-x 2 root root 4096 Dec 16 14:38 tmpfiles.d
drwxr-xr-x 1 root root 4096 Feb 7 11:57 udev
drwxr-xr-x 1 root root 4096 Feb 1 19:19 X11
-rw-r--r-- 1 root root 642 May 7 2020 xattr.conf
drwxr-xr-x 1 root root 4096 Feb 1 19:19 xdg
drwxr-xr-x 2 root root 4096 Feb 1 19:19 xinetd.d
---
#!/hint/bash
#
# /etc/makepkg.conf
#
...
SRCEXT='.src.tar.gz'
---
0
---
==> ERROR: /etc/makepkg.conf not found.
Aborting...
(The contents of /etc/makepkg.conf was concatenated.)
I also accidentally did [[ -r "/etc/makepkg.conf" ]] && echo 1 || echo 0 (as root) and I also got 0.
How is it possible that a file is not readable yet I can cat it? I also tried running the exact same commands in a local container and couldn't reproduce this issue, but this has happened every GitHub Actions run since it started.
This makes me think the Actions setup is causing an issue, but nothing seems odd there:
/usr/bin/docker build -t 442333:35a065f0b9f356b32f2852ba2f6b7296 -f "/home/runner/work/visual-studio-code-insiders-arch/visual-studio-code-insiders-arch/./.github/actions/pkg/Dockerfile" "/home/runner/work/visual-studio-code-insiders-arch/visual-studio-code-insiders-arch/.github/actions/pkg"
/usr/bin/docker run --name a065f0b9f356b32f2852ba2f6b7296_baf94b --label 442333 --workdir /github/workspace --rm -e pythonLocation -e LD_LIBRARY_PATH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/visual-studio-code-insiders-arch/visual-studio-code-insiders-arch":"/github/workspace" 442333:35a065f0b9f356b32f2852ba2f6b7296
Thanks for sharing this. I have precisely the same problems.
I added the following in my Dockerfile
RUN sed -i 's/\tif \[\[ -r $MAKEPKG_CONF \]\]; then/\tif \[\[ -f $MAKEPKG_CONF \]\]; then/' /usr/share/makepkg/util/config.sh
which replaces the check for read permission (-r) for the check whether the file exists and is a regular file (-f).
now my github action gets over this particular location, but fails with the next check:
==> ERROR: You do not have write permission for the directory $BUILDDIR (/tmp/aurutils).
Aborting...
This is not a solution and does not answer what's the underlying issue, but I hope it helps anyways.
This issue is caused by using glibc >= 2.33 on the container and an outdated version of the Docker engine on the host.
You can fix it by patching glibc in your container:
patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst
curl -LO https://repo.archlinuxcn.org/x86_64/$patched_glibc
bsdtar -C / -xvf $patched_glibc
Thanks to lxqt-panel for the workaround.

Resources