Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 329790 Details for
Bug 443728
app-laptop/prey-0.5.4-r1: /etc/init.d/prey-trigger is installed as invalid symlink, first run attempts to locate an rc3.d directory, system module error
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Functions patched again to locate files in init.d directory
functions (text/plain), 4.52 KB, created by
Justin M Griggs
on 2012-11-18 06:41:05 UTC
(
hide
)
Description:
Functions patched again to locate files in init.d directory
Filename:
MIME Type:
Creator:
Justin M Griggs
Created:
2012-11-18 06:41:05 UTC
Size:
4.52 KB
patch
obsolete
>#!/bin/bash >#################################################################### ># Prey Linux Specific Functions - by Tomas Pollak ># (c) 2010 Fork Ltd. (usefork.com) - Licensed under the GPLv3. >#################################################################### > >. "$platform_path/services" > >run_as_current_user(){ > if [ "`whoami`" != "$logged_user" ]; then > DISPLAY=:0 sudo su $logged_user -c "$1" > else > eval $1 > fi >} > >#################################################################### ># network stuff >#################################################################### > >get_mac_address(){ > ifconfig $1 2> /dev/null | grep 'HWaddr' | awk '{print $5}' >} > >get_ip_address(){ > ifconfig $1 2> /dev/null | grep "inet " | awk '{print $2}' | sed "s/addr://" >} > >get_netmask(){ > ifconfig $1 2> /dev/null | grep "Mask:" | awk '{print $4}' | sed "s/Mask://" >} > >get_gateway_ip() { > ip r | grep "$1" | grep default | cut -d ' ' -f 3 >} > >get_wifi_device() { > [ -z "$wifi_device" ] && wifi_device=$(iwconfig 2>&1 | grep -v "no wireless" | cut -f1 -d" " | grep -v "^$" | tail -1) >} > >get_wifi_info() { > [ -z "$wifi_info" ] && wifi_info=$(iwconfig 2>&1 | grep -v "no wireless") >} > ># attempts to connect to the first open public wifi network ># if we dont have NetworkManager available, we use plain iwconfig >try_to_connect() { > > if [ -n "$(is_process_running $network_manager_process)" ]; then > > log " -- Restarting $network_manager_process and giving it some time to connect." > service $network_manager_process restart &> /dev/null > sleep 5 > > else > > get_wifi_device > if [ -n "$wifi_device" ]; then > > # access_points=`iwlist $wifi_device | awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' | sort -k4 -k3nr` > local open_essid=`\`which iwlist\` $wifi_device scan | awk -F '[ :=]+' '/(ESS|Freq|Qual)/{ printf $3" " } /Encr/{ print $4 }' | sort -k4 -k3nr | grep "off" | head -1 | cut -d ' ' -f1 | sed 's/"//g'` > > if [ -n $open_essid ]; then > log " -- SSID found! Attempting to connect to ${open_essid}..." > `which iwconfig` $wifi_device essid $open_essid > `which dhclient3` $wifi_device > else > log ' -- No open SSIDs found.' > fi > > else > > log ' !! No wifi device found!' > > fi > > fi > >} > >reverse_tunnel_command(){ > setsid "$base_path/lib/tunnel.sh" ${remote_tunnel_host} ${local_tunnel_port} ${remote_tunnel_port} ${remote_tunnel_user} ${remote_tunnel_pass} &> /dev/null >} > >############################################ ># trigger enabling functions >############################################ > ># echoes 1 if prey trigger is set ># TODO: check if this works in other distros beside the Debian derivatives >is_trigger_loaded(){ > find /etc/rc3.d/ | grep 'prey-trigger' > /dev/null && echo 1 > find /etc/init.d/ | grep 'prey-trigger' > /dev/null && echo 1 >} > >reload_trigger(){ > log " -- Setting up network detection trigger init script..." > linux_load_service 'prey-trigger' >} > ># unloads trigger from launchd and removes plist file >unload_trigger(){ > log " -- Removing network detection trigger init script..." > linux_unload_service 'prey-trigger' >} > >############################################ ># updater-specific functions >############################################ > ># here we'll eventually put whatever we need to do in linux before ># performing a full update >pre_update_hook(){ > return 0 >} > ># post update hooks go in here >post_update_hook(){ > log ' -- Reloading Prey...' > "$base_path/prey.sh" & # lets restart prey now >} > >############################################ ># device creation stuff >############################################ > >get_pc_info(){ > pc_name=$(hostname) > > $(which laptop-detect) > if [ $? == 1 ]; then > pc_type="Desktop" > else > pc_type="Laptop" > fi > > get_distro_name > if [ "$distro_name" == "ubuntu" ]; then > pc_os_version=$(lsb_release -r | sed 's/.*\t//g') > elif [ "$distro_name" == "debian" ]; then > pc_os_version=$(cat /etc/debian_version) > fi > >} > >get_distro_name(){ > > [ -n "$distro_name" ] && return 1 > > proc_version=$(cat /proc/version) > > # todo: make this in a more efficient way > if [[ "$proc_version" == *Ubuntu* ]]; then > distro_name=ubuntu > elif [[ "$proc_version" == *Debian* ]]; then > distro_name=debian > elif [[ "$proc_version" == *Redhat* ]]; then > distro_name=redhat > elif [[ "$proc_version" == *Fedora* ]]; then > distro_name=fedora > elif [[ "$proc_version" == *CentOS* ]]; then > distro_name=redhat > elif [[ "$proc_version" == *SuSE* ]]; then > distro_name=suse > elif [[ "$proc_version" == *ArchLinux* ]]; then > distro_name=arch > elif [[ "$proc_version" == *Gentoo* ]]; then > distro_name=gentoo > else > distro_name=linux > fi > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 443728
:
329784
|
329786
|
329788
|
329790
|
329876
|
329878