Skip to content

Commit a99c740

Browse files
author
Tom Softreck
committed
Release version 0.1.15
### Added - Changes in scripts/README.md - Changes in scripts/checksum.sh
1 parent 2209a29 commit a99c740

File tree

6 files changed

+204
-151
lines changed

6 files changed

+204
-151
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.15] - 2025-04-03
6+
7+
### Added
8+
- Changes in scripts/README.md
9+
- Changes in scripts/checksum.sh
10+
511
## [0.1.14] - 2025-04-03
612

713
### Added

README.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,48 +58,70 @@ Skrypt automatycznie wykrywa menedżer pakietów i dostosowuje swoje działanie
5858

5959
---
6060

61-
## Instalacja
62-
63-
![install.png](img/install.png)
61+
### Metody instalacji
6462

65-
### Wymagania systemowe
6663

67-
- System operacyjny Linux (dowolna wspierana dystrybucja)
68-
- Bash w wersji 4.0 lub nowszej
69-
- Standardowe narzędzia wiersza poleceń (find, grep, awk, sed)
70-
- Uprawnienia administratora (root) dla pełnej funkcjonalności
64+
#### Wymagania
65+
- `curl`
66+
- `bash`
67+
- `sha256sum`
7168

72-
### Metody instalacji
7369

74-
#### Pobranie za pomocą wget
70+
#### Bezpieczna instalacja z weryfikacją sumy kontrolnej
7571

7672
```bash
77-
wget https://raw.githubusercontent.com/DevOpsTerminal/hello/main/hello.sh
78-
wget https://hello.devopsterminal.com/hello.sh
73+
# Metoda 1: Bezpośrednie pobranie i wykonanie
74+
wget -O install.sh https://raw.githubusercontent.com/DevOpsTerminal/hello/main/install.sh && bash install.sh
7975

76+
# Metoda 2: Alternatywne źródło
77+
curl -sSL https://hello.devopsterminal.com/install.sh | bash
8078
```
8179

82-
#### Pobranie za pomocą curl
80+
#### Ręczne pobieranie i weryfikacja
8381

8482
```bash
85-
curl -sSL https://raw.githubusercontent.com/DevOpsTerminal/hello/main/hello.sh | bash
86-
curl -sSL https://hello.devopsterminal.com/hello.sh -o hello.sh
83+
# Pobierz skrypt
84+
wget https://raw.githubusercontent.com/DevOpsTerminal/hello/main/hello.sh
85+
86+
# Pobierz sumę kontrolną
87+
wget https://raw.githubusercontent.com/DevOpsTerminal/hello/main/checksums.sha256
88+
89+
# Zweryfikuj sumę kontrolną
90+
sha256sum -c checksums.sha256
8791
```
8892

89-
#### Uruchomienie
93+
#### Bezpośrednie pobranie i uruchomienie
9094

9195
```bash
92-
# Przejrzyj zawartość skryptu
93-
cat hello.sh
96+
# Za pomocą curl
97+
curl -sSL https://raw.githubusercontent.com/DevOpsTerminal/hello/main/hello.sh -o hello.sh
98+
99+
# Za pomocą wget
100+
wget https://raw.githubusercontent.com/DevOpsTerminal/hello/main/hello.sh
94101

95102
# Nadaj uprawnienia wykonania
96103
chmod +x hello.sh
97104

98-
# Uruchomienie skryptu
105+
# Uruchom skrypt
99106
./hello.sh
100107
```
101108

102109

110+
## Support
111+
112+
- Upewnij się, że posiadasz wymagane narzędzia (`curl`, `bash`, `sha256sum`)
113+
- Sprawdź połączenie internetowe
114+
- Zweryfikuj sumę kontrolną przed uruchomieniem skryptu
115+
116+
- **Suma kontrolna**: Każde pobranie jest weryfikowane za pomocą SHA256
117+
- **Źródła**: Oficjalne repozytorium GitHub i domena DevOps Terminal
118+
- **Uprawnienia**: Możliwość uruchomienia bez uprawnień roota
119+
120+
## Wsparcie
121+
122+
W razie problemów skontaktuj się z administratorem lub otwórz zgłoszenie w repozytorium GitHub.
123+
124+
103125

104126
#### Instalacja dla użytkowników bez uprawnień roota
105127

checksums/checksums.sha256

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
da4b0764b7ed89fb90d6947a435e339fab378b484c1b94c132a347c04cd729e6 hello.sh

install.sh

Lines changed: 63 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,78 @@
11
#!/bin/bash
22

3-
# Portfolio Generator Installation Script
4-
5-
# Exit on error
6-
set -e
7-
8-
# Define colors for output
9-
GREEN='\033[0;32m'
10-
YELLOW='\033[1;33m'
11-
RED='\033[0;31m'
12-
NC='\033[0m' # No Color
13-
14-
echo -e "${YELLOW}Portfolio Generator Installation${NC}"
15-
echo "This script will install the Portfolio Generator and set it up to run automatically."
16-
echo
17-
18-
# Check Python version
19-
echo -e "${YELLOW}Checking Python version...${NC}"
20-
if command -v python3 &>/dev/null; then
21-
python_version=$(python3 --version)
22-
echo -e "${GREEN}Found $python_version${NC}"
23-
else
24-
echo -e "${RED}Python 3 is not installed. Please install Python 3.6 or newer.${NC}"
25-
exit 1
26-
fi
27-
28-
# Create directory
29-
echo -e "${YELLOW}Creating project directory...${NC}"
30-
read -p "Enter directory path for installation [./portfolio-generator]: " install_dir
31-
install_dir=${install_dir:-./portfolio-generator}
32-
33-
mkdir -p "$install_dir"
34-
cd "$install_dir"
35-
echo -e "${GREEN}Created directory: $install_dir${NC}"
3+
# Adres projektu i główny skrypt
4+
PROJECT_URL="https://raw.githubusercontent.com/DevOpsTerminal/hello/main"
5+
SCRIPT_NAME="hello.sh"
6+
CHECKSUM_NAME="checksums.sha256"
7+
8+
# Funkcja do logowania z kolorami
9+
log_error() {
10+
echo -e "\e[31m[BŁĄD]\e[0m $1" >&2
11+
}
3612

37-
# Download script
38-
echo -e "${YELLOW}Downloading portfolio generator script...${NC}"
39-
wget -O portfolio_generator.py https://raw.githubusercontent.com/yourusername/portfolio-generator/main/portfolio_generator.py || {
40-
echo -e "${RED}Failed to download script. Creating a new one from your clipboard...${NC}"
41-
echo "Please paste the script content and press Ctrl+D when finished:"
42-
cat > portfolio_generator.py
13+
log_success() {
14+
echo -e "\e[32m[SUKCES]\e[0m $1"
4315
}
44-
chmod +x portfolio_generator.py
45-
echo -e "${GREEN}Script saved to portfolio_generator.py${NC}"
4616

47-
# Create domains.txt
48-
echo -e "${YELLOW}Creating domains.txt file...${NC}"
49-
if [ ! -f domains.txt ]; then
50-
echo "Please enter domain names (one per line). Press Ctrl+D when finished:"
51-
cat > domains.txt
52-
echo -e "${GREEN}Created domains.txt with your domains${NC}"
53-
else
54-
echo -e "${GREEN}domains.txt already exists${NC}"
55-
fi
17+
log_info() {
18+
echo -e "\e[34m[INFO]\e[0m $1"
19+
}
5620

57-
# Install dependencies
58-
echo -e "${YELLOW}Installing Python dependencies...${NC}"
59-
pip3 install --user requests beautifulsoup4 scikit-learn numpy pillow schedule gitpython
60-
echo -e "${GREEN}Dependencies installed${NC}"
21+
# Funkcja pobierająca i weryfikująca sumę kontrolną
22+
download_and_verify() {
23+
# Pobierz sumę kontrolną
24+
log_info "Pobieranie sumy kontrolnej..."
25+
local remote_checksum=$(curl -sSL "${PROJECT_URL}/${CHECKSUM_NAME}" | grep "${SCRIPT_NAME}" | awk '{print $1}')
6126

62-
# Create output directory
63-
mkdir -p portfolio
27+
if [ -z "$remote_checksum" ]; then
28+
log_error "Nie udało się pobrać sumy kontrolnej!"
29+
return 1
30+
fi
6431

65-
# Create systemd service file
66-
echo -e "${YELLOW}Setting up automatic execution...${NC}"
67-
read -p "Do you want to set up a systemd service to run the script automatically? (y/n) " setup_systemd
32+
# Pobierz skrypt
33+
log_info "Pobieranie skryptu instalacyjnego..."
34+
curl -sSL "${PROJECT_URL}/${SCRIPT_NAME}" > "${SCRIPT_NAME}"
6835

69-
if [ "$setup_systemd" = "y" ] || [ "$setup_systemd" = "Y" ]; then
70-
username=$(whoami)
71-
current_dir=$(pwd)
72-
73-
cat > portfolio-generator.service << EOF
74-
[Unit]
75-
Description=Portfolio Generator Service
76-
After=network.target
36+
# Sprawdź sumę kontrolną
37+
log_info "Weryfikacja sumy kontrolnej..."
38+
local local_checksum=$(sha256sum "${SCRIPT_NAME}" | awk '{print $1}')
7739

78-
[Service]
79-
Type=simple
80-
User=$username
81-
WorkingDirectory=$current_dir
82-
ExecStart=/usr/bin/python3 $current_dir/portfolio_generator.py
83-
Restart=on-failure
84-
StandardOutput=syslog
85-
StandardError=syslog
86-
SyslogIdentifier=portfolio-generator
40+
if [ "$remote_checksum" != "$local_checksum" ]; then
41+
log_error "OSTRZEŻENIE: Suma kontrolna nie zgadza się!"
42+
log_error "Suma zdalna: $remote_checksum"
43+
log_error "Suma lokalna: $local_checksum"
44+
rm "${SCRIPT_NAME}"
45+
return 1
46+
fi
8747

88-
[Install]
89-
WantedBy=multi-user.target
90-
EOF
91-
92-
echo -e "${GREEN}Created systemd service file: portfolio-generator.service${NC}"
93-
echo "To install the service, run the following commands:"
94-
echo " sudo cp portfolio-generator.service /etc/systemd/system/"
95-
echo " sudo systemctl daemon-reload"
96-
echo " sudo systemctl enable portfolio-generator.service"
97-
echo " sudo systemctl start portfolio-generator.service"
98-
else
99-
echo "To set up automatic execution, you can add a cron job:"
100-
echo " crontab -e"
101-
echo "Then add this line to run daily at 16:00:"
102-
echo " 0 16 * * * cd $(pwd) && /usr/bin/python3 portfolio_generator.py"
103-
fi
48+
# Nadaj uprawnienia wykonania
49+
chmod +x "${SCRIPT_NAME}"
50+
log_success "Suma kontrolna zweryfikowana poprawnie!"
10451

105-
# Set up Git
106-
echo -e "${YELLOW}Setting up Git repository...${NC}"
107-
read -p "Do you want to set up a Git repository? (y/n) " setup_git
52+
# Uruchom skrypt
53+
log_info "Uruchamianie skryptu..."
54+
./"${SCRIPT_NAME}"
55+
}
10856

109-
if [ "$setup_git" = "y" ] || [ "$setup_git" = "Y" ]; then
110-
cd portfolio
111-
git init
112-
echo "*.log" > .gitignore
113-
echo "__pycache__/" >> .gitignore
114-
echo "*.py[cod]" >> .gitignore
115-
echo "*$py.class" >> .gitignore
116-
git add .
117-
git commit -m "Initial commit"
118-
119-
read -p "Enter remote repository URL (leave empty to skip): " remote_url
120-
if [ ! -z "$remote_url" ]; then
121-
git remote add origin "$remote_url"
122-
echo -e "${GREEN}Remote repository added: $remote_url${NC}"
123-
echo "To push to remote repository, run:"
124-
echo " cd $(pwd) && git push -u origin main"
57+
# Główna logika
58+
main() {
59+
# Sprawdź wymagane narzędzia
60+
for tool in curl sha256sum; do
61+
if ! command -v "$tool" &> /dev/null; then
62+
log_error "Wymagane narzędzie $tool nie jest zainstalowane!"
63+
exit 1
64+
fi
65+
done
66+
67+
# Wykonaj pobieranie i weryfikację
68+
if download_and_verify; then
69+
log_success "Instalacja zakończona sukcesem!"
70+
exit 0
71+
else
72+
log_error "Instalacja nie powiodła się!"
73+
exit 1
12574
fi
126-
cd ..
127-
echo -e "${GREEN}Git repository initialized${NC}"
128-
fi
129-
130-
# Run the script
131-
echo -e "${YELLOW}Running the portfolio generator for the first time...${NC}"
132-
read -p "Do you want to run the script now? (y/n) " run_now
133-
134-
if [ "$run_now" = "y" ] || [ "$run_now" = "Y" ]; then
135-
python3 portfolio_generator.py
136-
echo -e "${GREEN}Script executed! Check the portfolio/index.html file.${NC}"
137-
else
138-
echo -e "${GREEN}You can run the script manually with:${NC}"
139-
echo " cd $(pwd) && python3 portfolio_generator.py"
140-
fi
75+
}
14176

142-
echo
143-
echo -e "${GREEN}Installation complete!${NC}"
144-
echo "Your portfolio generator is set up in: $install_dir"
145-
echo "Generated portfolio will be in: $install_dir/portfolio/index.html"
146-
echo
147-
echo "Thank you for using Portfolio Generator!"
77+
# Uruchom główną funkcję
78+
main

scripts/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Weryfikacja Sum Kontrolnych
2+
3+
## Jak używać
4+
5+
### Generowanie Sum Kontrolnych
6+
```bash
7+
# Wygeneruj sumy kontrolne
8+
./scripts/checksum.sh generate
9+
```
10+
11+
### Weryfikacja Plików
12+
```bash
13+
# Sprawdź integralność plików
14+
./scripts/checksum.sh verify
15+
```
16+
17+
## Dlaczego to jest bezpieczne?
18+
19+
1. **Automatyczne generowanie**: Skrypt automatycznie tworzy sumy kontrolne dla kluczowych plików.
20+
2. **Łatwa weryfikacja**: Możliwość jednoczesnego sprawdzenia wszystkich plików.
21+
3. **Bezpieczeństwo**: Zapobiega nieautoryzowanym modyfikacjom.
22+
23+
### Przykładowy Scenariusz Użycia
24+
25+
```bash
26+
# Na serwerze/w repozytorium
27+
./scripts/checksum.sh generate # Generuje aktualny plik sum kontrolnych
28+
29+
# U użytkownika
30+
./scripts/checksum.sh verify # Sprawdza integralność plików
31+
```
32+
33+
## Uwagi Bezpieczeństwa
34+
- Zawsze weryfikuj źródło skryptu
35+
- Regularnie aktualizuj sumy kontrolne
36+
- Przechowuj plik sum kontrolnych bezpiecznie

0 commit comments

Comments
 (0)