Files
EMERGENCY/skel/pdfs/seed-everything.sh
2026-06-30 18:30:24 +00:00

110 lines
5.7 KiB
Bash
Executable File

#!/bin/bash
# COMPREHENSIVE Reference PDF Library Seeder
# Covers Trades, Agriculture, Energy, Wilderness, Food, Chemistry,
# Mechanical, Comms, Medical, Military, Gov/Law, Navigation, Skills,
# Finance, Pet/Livestock
set -u
TMP=/tmp/pdf-seed-all
API=http://localhost/pdfs/api/upload
mkdir -p "$TMP"
PDFS=(
# ========== TRADES & REPAIR ==========
"https://archive.org/download/bwb_Y0-BMG-117/bwb_Y0-BMG-117.pdf|Audels Plumbers and Steam Fitters Guide #3 (1925)|trades"
"https://archive.org/download/cu31924004933945/cu31924004933945.pdf|Henleys Twentieth Century Book of Formulas (1909)|trades"
"https://archive.org/download/theboymechanicvo12655gut/theboymechanicvo12655gut.pdf|The Boy Mechanic Vol 1 (1913)|trades"
"https://archive.org/download/the-boy-mechanic-book-2-1000-things-for-unknown/The%20Boy%20Mechanic%2C%20Book%202%20%281915%29%20-%201%2C000%20Things%20for%20Boys%20to%20Do.pdf|The Boy Mechanic Vol 2 (1915)|trades"
"https://rexresearch1.com/AudelManuals/AudelPipefittersWeldersPocketManual.pdf|Audel Pipefitters and Welders Pocket Manual|trades"
# ========== AGRICULTURE / SELF-SUFFICIENCY ==========
# USDA Farmers Bulletins must be sourced individually; placing 1 sample
"https://naldc.nal.usda.gov/download/CAT74420061/PDF|USDA Farmers Bulletin No 1186 - Pork on the Farm|agriculture"
# ========== ENERGY / OFF-GRID ==========
"https://www.nrel.gov/docs/fy20osti/76011.pdf|NREL Off-Grid PV System Design Sizing Guide|energy"
# ========== WILDERNESS / OUTDOOR ==========
# Boy Scout Handbook 1911 is text-only on Gutenberg; sourcing alternate scan
"https://archive.org/download/boyscoutshandboo00boys/boyscoutshandboo00boys.pdf|Boy Scouts Handbook First Edition (1911)|wilderness"
# ========== FOOD / COOKING / PRESERVATION ==========
"https://archive.org/download/bostoncookingsc00farm/bostoncookingsc00farm.pdf|Boston Cooking School Cook Book - Fannie Farmer (1918)|food"
"https://nchfp.uga.edu/how/dry/food_drying_what_you_need_to_know.pdf|USDA NCHFP - Food Drying What You Need to Know|food"
# ========== CHEMISTRY / SCIENCE ==========
"https://archive.org/download/CRCHandbookOfChemistryAndPhysics97thEdition2016/CRC%20Handbook%20of%20Chemistry%20and%20Physics%2C%2097th%20Edition.pdf|CRC Handbook of Chemistry and Physics 97th Edition (2016)|chemistry"
# ========== MECHANICAL / ENGINEERING ==========
# Machinery's Handbook 6th already added in original batch
# ========== VEHICLE (manual sourcing recommended) ==========
# Ram 1500 / Cub Cadet FSMs typically need OEM login - skipped
# ========== COMMUNICATIONS ==========
# ARRL/Antenna books are paid; skipped
# ========== MEDICAL DEPTH ==========
"https://ia801609.us.archive.org/9/items/civilian-and-non-civilian-medical-guides/Ranger%20Medic%20Handbook%20%282007%29.pdf|Ranger Medic Handbook (2007)|medical"
"https://archive.org/download/SOFMH2001/SOFMH2001.pdf|Special Operations Forces Medical Handbook (2001)|medical"
"https://archive.org/download/where-there-is-no-vet/where-there-is-no-vet.pdf|Where There Is No Vet|veterinary"
# ========== MILITARY / TACTICAL ==========
"https://archive.org/download/Jungle_Operations_FM_90-5/Jungle_Operations_FM_90-5.pdf|FM 90-5 Jungle Operations (1982)|defense"
"https://ia801302.us.archive.org/16/items/FM31_21_1961/FM31_21_1961.pdf|FM 31-21 Guerrilla Warfare and Special Forces Operations (1961)|defense"
"https://archive.org/download/usa-tm-31-210-improvised-munitions-handbook/USA%20TM%2031%20210%20Improvised%20Munitions%20Handbook.pdf|TM 31-210 Improvised Munitions Handbook (1969)|defense"
# ========== GOVERNMENT / LAW ==========
"https://archive.org/download/TheFederalistPapers_201607/The%20Federalist%20Papers.pdf|The Federalist Papers|law"
"https://archive.org/download/roberts-rules-of-order/roberts-rules-of-order.pdf|Roberts Rules of Order (Parliamentary Procedure)|law"
"https://statutes.capitol.texas.gov/docs/sdocs/penalcode.pdf|Texas Penal Code|law"
"https://statutes.capitol.texas.gov/docs/sdocs/familycode.pdf|Texas Family Code|law"
"https://statutes.capitol.texas.gov/docs/sdocs/propertycode.pdf|Texas Property Code|law"
"https://statutes.capitol.texas.gov/docs/sdocs/cn.pdf|Texas Constitution|law"
# ========== NAVIGATION DEPTH ==========
# Bowditch V1+V2 already included; USGS topo symbols below
"https://pubs.usgs.gov/gip/TopographicMapSymbols/topomapsymbols.pdf|USGS Topographic Map Symbols|navigation"
# ========== SPECIFIC SKILLS ==========
# Welding/knots/blacksmithing - most under restricted access, manual sourcing
# ========== FINANCE / PRACTICAL LIFE ==========
"https://www.irs.gov/pub/irs-pdf/p17.pdf|IRS Publication 17 - Your Federal Income Tax|finance"
# ========== PETS / LIVESTOCK ==========
# Where There Is No Vet already in medical above
)
ok=0; fail=0; total=${#PDFS[@]}; i=0
for entry in "${PDFS[@]}"; do
i=$((i+1))
IFS='|' read -r url title tag <<< "$entry"
fname=$(echo "$title" | tr -c 'A-Za-z0-9._-' '_' | head -c 100).pdf
out="$TMP/$fname"
echo ""
echo "==> [$i/$total] [$title]"
if wget -q --show-progress -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36" --tries=2 --timeout=120 -O "$out" "$url"; then
sz_bytes=$(stat -c%s "$out" 2>/dev/null || echo 0)
if [ "$sz_bytes" -gt 100000 ] && file "$out" | grep -qi "PDF"; then
sz=$(du -h "$out" | cut -f1)
curl -s -X POST "$API" -F "file=@$out;type=application/pdf" -F "title=$title" -F "tag=$tag" > /dev/null
echo " ✓ uploaded ($sz)"
ok=$((ok+1))
else
echo " ✗ skipped (not a valid PDF, $sz_bytes bytes)"
fail=$((fail+1))
fi
rm -f "$out"
else
echo " ✗ download failed"
fail=$((fail+1))
fi
done
echo ""
echo "================================"
echo "OK: $ok Failed: $fail Total: $total"
echo "================================"
rm -rf "$TMP"