blob: e380b5188d6f54700394d6f8c781d122ccfe0b09 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  | 
#!/usr/bin/env	bash
upgrade_options=''
ARGS=$(getopt -a -o hy --long opts:,help -- "$@")
update_database() {
    echo 'Updating database...'
    apt update
}
upgrade_packages() {
    echo 'Upgrading packages...'
    apt upgrade $upgrade_options
}
help_page() {
    echo "Usage:"
    echo "apt-up [-y] [-h] [--opts $upgrade_options]"
    echo "Description:"
    echo -e "\t-y automates the upgrade progress."
    echo -e "\t-h diaplays the help page of apt-up."
    echo -e '\t--opts transports $upgrade_options to apt.'
    exit -1
}
update() {
    update_database
    upgrade_packages
    exit 0
}
eval set -- "${ARGS}"
while :; do
    case $1 in
    -y | --yes)
        upgrade_options+='-y '
        update
        ;;
    -h | --help)
        help_page
        ;;
    *)
        update
        ;;
    --opts)
        upgrade_options+=$2
        update
        shift
        ;;
    esac
    shift
done
 
  |