forked from uchks/repo.me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updaterepo.sh
91 lines (69 loc) · 3.63 KB
/
updaterepo.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
if [[ "$OSTYPE" == "linux"* ]]; then # Linux usage of repo.me
cd "$(dirname "$0")" || exit
rm Packages Packages.xz Packages.gz Packages.bz2 Packages.zst Release 2> /dev/null
apt-ftparchive packages ./debians > Packages
gzip -c9 Packages > Packages.gz
xz -c9 Packages > Packages.xz
zstd -c19 Packages > Packages.zst
bzip2 -c9 Packages > Packages.bz2
apt-ftparchive release -c ./assets/repo/repo.conf . > Release
echo "Repository Updated, thanks for using repo.me!"
elif [[ "$(uname)" == Darwin ]] && [[ "$(uname -p)" == i386 ]]; then # macOS usage of repo.me
cd "$(dirname "$0")" || exit
echo "Checking for Homebrew, wget, xz, & zstd..."
if test ! "$(which brew)"; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
brew list --verbose wget || brew install wget
brew list --verbose xz || brew install xz
brew list --verbose zstd || brew install zstd
clear
echo "apt-ftparchive compiled by @Diatrus" # credits to Hayden!
wget -q -nc https://apt.procurs.us/apt-ftparchive # assuming Homebrew is already installed, download apt-ftparchive via wget
sudo chmod 751 ./apt-ftparchive # could change this to be pointed in documentation, but people don't like to read what needs READING. i'll think about it later.
rm {Packages{,.xz,.gz,.bz2,.zst},Release{,.gpg}} 2> /dev/null
./apt-ftparchive packages ./debians > Packages
gzip -c9 Packages > Packages.gz
xz -c9 Packages > Packages.xz
zstd -c19 Packages > Packages.zst
bzip2 -c9 Packages > Packages.bz2
./apt-ftparchive release -c ./assets/repo/repo.conf . > Release
echo "Repository Updated, thanks for using repo.me!"
elif [[ "$(uname -r)" == *Microsoft ]]; then # WSL 1 usage of repo.me
cd "$(dirname "$0")" || exit
rm Packages Packages.xz Packages.gz Packages.bz2 Packages.zst Release 2> /dev/null
apt-ftparchive packages ./debians > Packages
gzip -c9 Packages > Packages.gz
xz -c9 Packages > Packages.xz
zstd -c19 Packages > Packages.zst
bzip2 -c9 Packages > Packages.bz2
apt-ftparchive release -c ./assets/repo/repo.conf . > Release
echo "Repository Updated, thanks for using repo.me!"
elif [[ "$(uname -r)" == *microsoft-standard ]]; then # WSL 2 usage of repo.me
cd "$(dirname "$0")" || exit
rm Packages Packages.xz Packages.gz Packages.bz2 Packages.zst Release 2> /dev/null
apt-ftparchive packages ./debians > Packages
gzip -c9 Packages > Packages.gz
xz -c9 Packages > Packages.xz
zstd -c19 Packages > Packages.zst
bzip2 -c9 Packages > Packages.bz2
apt-ftparchive release -c ./assets/repo/repo.conf . > Release
echo "Repository Updated, thanks for using repo.me!"
elif [[ "$(uname)" == Darwin ]] && [[ "$(uname -p)" != i386 ]]; then # iOS/iPadOS usage of repo.me
cd "$(dirname "$0")" || exit
echo "Checking for apt-ftparchive..."
if test ! "$(apt-ftparchive)"; then
apt update && apt install apt-utils -y
fi
rm {Packages{,.xz,.gz,.bz2,.zst},Release{,.gpg}} 2> /dev/null
apt-ftparchive packages ./debians > Packages
gzip -c9 Packages > Packages.gz
xz -c9 Packages > Packages.xz
zstd -c19 Packages > Packages.zst
bzip2 -c9 Packages > Packages.bz2
apt-ftparchive release -c ./assets/repo/repo.conf . > Release
echo "Repository Updated, thanks for using repo.me!"
else
echo "Running an unsupported operating system...? Contact me via Twitter @truesyns" # incase I've missed support for something, they should be contacting me.
fi