diff --git a/shellscripte/usbrepo/create_offline_repo.sh b/shellscripte/usbrepo/create_offline_repo.sh new file mode 100644 index 0000000000000000000000000000000000000000..a50332642d6259ad1203447953f74078c5b42b34 --- /dev/null +++ b/shellscripte/usbrepo/create_offline_repo.sh @@ -0,0 +1,22 @@ +#!/bin/bash +PKG_LIST="linux-firmware-nonfree swi-prolog cowsay fish get-flash-videos gnome haskell-platform java7-jdk imagemagick rxvt-unicode moc nethack-console scrot sl tmux vim xcowsay zsh zsh-doc texmaker gimp pidgin smplayer subversion git lftp inkscape" +DESTINATION="/isodevice" +SECTIONNAME=lipoffline +ARCHITECTURE=$1 +ARCHIVE_DESTINATION=$DESTINATION/archives +REL_DISTS_PATH=dists/main/$SECTIONNAME/binary-$ARCHITECTURE +PKG_DESTINATION=$ARCHIVE_DESTINATION/$REL_DISTS_PATH + +#begin +echo "creating structure..." +mkdir -p $PKG_DESTINATION/ +echo "done." +echo "downloading archives. this may take some time..." +wget -nc -P $PKG_DESTINATION $(apt-get -o APT::Architecture=$ARCHITECTURE install --reinstall --print-uris -qq $PKG_LIST | cut -d"'" -f2) +#wget -nc -P $PKG_DESTINATION $(apt-get -o APT::Architecture=$ARCHITECTURE install --reinstall --allow-unauthenticated --print-uris -qq $PKG_LIST | cut -d"'" -f2) +echo "done." +echo "creating meta files..." +cd $ARCHIVE_DESTINATION +apt-ftparchive packages $REL_DISTS_PATH > $REL_DISTS_PATH/Packages +gzip $REL_DISTS_PATH/Packages +echo "done." diff --git a/shellscripte/usbrepo/infuse_offline_repo.sh b/shellscripte/usbrepo/infuse_offline_repo.sh new file mode 100644 index 0000000000000000000000000000000000000000..1be0d4dac70970c331d94713ca500d40ce3c1eb9 --- /dev/null +++ b/shellscripte/usbrepo/infuse_offline_repo.sh @@ -0,0 +1,38 @@ +#!/bin/bash +PKG_LIST="cowsay fish get-flash-videos gnome haskell-platform java7-jdk imagemagick rxvt-unicode moc nethack-console scrot sl tmux vim xcowsay zsh zsh-doc texmaker gimp pidgin smplayer subversion git lftp inkscape" + +source mount-stick-repo.sh #detect mountpoint + +if [ -n $MPOINT ]; then + SOURCE_PATH="$MPOINT" + + #check if we have root perms? + MERGE_DIR=$(mktemp -d) + CACHE_DIR="/var/cache/apt/archives/" + ARCH="i386" + if [ "$(uname -m)" = "x86_64" ]; then + ARCH="amd64" + fi + OVERLAY_DIR="$SOURCE_PATH/archives/dists/main/lipoffline/binary-$ARCH/" + + echo "Detected architecture $ARCH -> overlay dir is $OVERLAY_DIR" + + # test if there is already an overlayfs at CACHE_DIR + if [ "$(stat --format %m "$CACHE_DIR")" = "${CACHE_DIR%/}" ] + then + echo "The Overlayfs is already there. Using it." + else + echo "Making an overlay FS with your repository." + mkdir -p "$MERGE_DIR" + mount -t overlayfs -o "rw,lowerdir=$OVERLAY_DIR,upperdir=$CACHE_DIR" overlayfs "$MERGE_DIR" + mount --move "$MERGE_DIR" "$CACHE_DIR" + rmdir "$MERGE_DIR" + fi +else + echo "No stick, no repo; good luck." +fi + +apt-get install $APT_OPTIONS $PKG_LIST #exec lip install script here? + +#end; + diff --git a/shellscripte/usbrepo/mount-stick-repo.sh b/shellscripte/usbrepo/mount-stick-repo.sh new file mode 100644 index 0000000000000000000000000000000000000000..72231200bb5598c4d43abc9fcdfd49c58d914b40 --- /dev/null +++ b/shellscripte/usbrepo/mount-stick-repo.sh @@ -0,0 +1,46 @@ +#! /bin/bash + +#find device +DEV="$(blkid -t "LABEL=MultiBoot" -o device)" +while [ -z "$DEV" ]; do + echo "Der LIP-Install-USB-Stick wurde nicht gefunden." + echo "Jetzt einstecken oder ohne Weitermachen" + select i in "Stick ist jetzt gesteckt" \ +"Ohne Stick Weitermachen" \ +"Installation abbrechen" ; do + case $i in + "Stick ist jetzt gesteckt") + DEV="$(blkid -t "LABEL=MultiBoot" -o device)" + ;; + "Ohne Stick Weitermachen") + DEV='-nomount-' + ;; + "Installation abbrechen") + exit 0 + ;; + *) + echo "Das sollte nicht passieren. Helfer fragen." + exit 99 + ;; + esac + break + done +done + +if [ "$DEV" = "-nomount-" ]; then + echo "Mache ohne USB-Stick weiter." + MPOINT="" + #exit 0 +else + echo "Stick gefunden als $DEV" + + # ask udisks to mount it always. + udisks --mount "$DEV" + + # see where it is mounted + DEVFILE=${DEV#/dev/} + MPOINT="$(qdbus --system org.freedesktop.UDisks /org/freedesktop/UDisks/devices/${DEVFILE} org.freedesktop.DBus.Properties.Get org.freedesktop.UDisks.Device "DeviceMountPaths" | head -n1)" + + echo "Der Stick it als '$MPOINT' gemountet" +fi +#end;