-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeb-reversion-v2.sh
executable file
·38 lines (30 loc) · 1.07 KB
/
deb-reversion-v2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -oue pipefail
CURRENT_DIR="$(pwd)"
SOURCE_DIR="$(pwd)/ori" # Directory containing the original .deb files
DATE=$(date +%Y%m%d) # Current date in YYYYMMDD format
# Iterate over all .deb files in the source directory
for deb_file in "$SOURCE_DIR"/*.deb; do
if [ -f "$deb_file" ]; then
{
echo "Processing: $deb_file"
# Get the original version number from the .deb file
original_version=$(dpkg-deb --info "$deb_file" | grep Version | awk '{print $2}')
# Modify the version number and apply changes directly to the original .deb file
fpm -t deb -s deb \
--version "${original_version}+${DATE}" --deb-compression xz\
-p $PWD "$deb_file"
# Remove the original file after processing
rm -f "$deb_file"
} &
else
echo "Skipping: $deb_file"
fi
done
# Wait for all parallel tasks to complete
wait
echo "deb-reversion works are done, all modified files are in: $CURRENT_DIR"
echo "Cleanup......."
rm -r "$SOURCE_DIR"
echo "Run ls"
ls