Files
scratchpkg/extra/listinstall
2017-12-08 21:18:36 +08:00

40 lines
673 B
Bash
Executable File

#!/bin/bash -e
INDEX_DIR="/var/lib/scratchpkg/index"
source "/usr/share/scratchpkg/color"
source "/usr/share/scratchpkg/message"
if [ ! "$1" ]; then
msgerr "Please specify list file."
exit 1
fi
if [ ! -f "$1" ]; then
msgerr "File '$1' not exist."
exit 1
fi
list=$(cat $1)
for i in $list; do
if [ -d $INDEX_DIR/$i ]; then
msg "$i ${color_green}[installed]${color_reset}"
else
echo
msg "installing $i..."
if [ $UID != 0 ]; then
sudo scratch -p $i -i
else
scratch -p $i -i
fi
if [ ! -d $INDEX_DIR/$i ]; then
msgerr "Failed installing $i."
msgerr "Press ENTER to skip and continue, press CTRL + C to cancel."
read
fi
fi
done
exit 0