infuse_offline_repo.sh 1.17 KB
Newer Older
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
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;